comparison core/modules/views_ui/src/ViewEditForm.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 <?php 1 <?php
2 2
3 namespace Drupal\views_ui; 3 namespace Drupal\views_ui;
4 4
5 use Drupal\Component\Utility\Html; 5 use Drupal\Component\Utility\Html;
6 use Drupal\Component\Utility\SafeMarkup; 6 use Drupal\Component\Render\FormattableMarkup;
7 use Drupal\Core\Ajax\AjaxResponse; 7 use Drupal\Core\Ajax\AjaxResponse;
8 use Drupal\Core\Ajax\HtmlCommand; 8 use Drupal\Core\Ajax\HtmlCommand;
9 use Drupal\Core\Ajax\ReplaceCommand; 9 use Drupal\Core\Ajax\ReplaceCommand;
10 use Drupal\Core\Datetime\DateFormatterInterface; 10 use Drupal\Core\Datetime\DateFormatterInterface;
11 use Drupal\Core\Form\FormStateInterface; 11 use Drupal\Core\Form\FormStateInterface;
323 $form_state->setRedirectUrl(Url::fromUri("base:$destination")); 323 $form_state->setRedirectUrl(Url::fromUri("base:$destination"));
324 } 324 }
325 325
326 $view->save(); 326 $view->save();
327 327
328 drupal_set_message($this->t('The view %name has been saved.', ['%name' => $view->label()])); 328 $this->messenger()->addStatus($this->t('The view %name has been saved.', ['%name' => $view->label()]));
329 329
330 // Remove this view from cache so we can edit it properly. 330 // Remove this view from cache so we can edit it properly.
331 $this->tempStore->delete($view->id()); 331 $this->tempStore->delete($view->id());
332 } 332 }
333 333
1096 'id' => $id, 1096 'id' => $id,
1097 ], ['attributes' => $link_attributes])); 1097 ], ['attributes' => $link_attributes]));
1098 $build['fields'][$id]['#class'][] = Html::cleanCssIdentifier($display['id'] . '-' . $type . '-' . $id); 1098 $build['fields'][$id]['#class'][] = Html::cleanCssIdentifier($display['id'] . '-' . $type . '-' . $id);
1099 1099
1100 if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) { 1100 if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) {
1101 $build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [ 1101 $build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [
1102 'js' => 'nojs', 1102 'js' => 'nojs',
1103 'view' => $view->id(), 1103 'view' => $view->id(),
1104 'display_id' => $display['id'], 1104 'display_id' => $display['id'],
1105 'type' => $type, 1105 'type' => $type,
1106 'id' => $id, 1106 'id' => $id,
1107 ], ['attributes' => ['class' => ['views-button-configure', 'views-ajax-link'], 'title' => $this->t('Aggregation settings')]])); 1107 ], ['attributes' => ['class' => ['views-button-configure', 'views-ajax-link'], 'title' => $this->t('Aggregation settings')]]));
1108 } 1108 }
1109 1109
1110 if ($handler->hasExtraOptions()) { 1110 if ($handler->hasExtraOptions()) {
1111 $build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [ 1111 $build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [
1112 'js' => 'nojs', 1112 'js' => 'nojs',
1113 'view' => $view->id(), 1113 'view' => $view->id(),
1114 'display_id' => $display['id'], 1114 'display_id' => $display['id'],
1115 'type' => $type, 1115 'type' => $type,
1116 'id' => $id, 1116 'id' => $id,
1145 $keys = array_keys($contents); 1145 $keys = array_keys($contents);
1146 $last = end($keys); 1146 $last = end($keys);
1147 foreach ($contents as $key => $pid) { 1147 foreach ($contents as $key => $pid) {
1148 if ($key != $last) { 1148 if ($key != $last) {
1149 $operator = $group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND'); 1149 $operator = $group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND');
1150 $store[$pid]['#link'] = SafeMarkup::format('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]); 1150 $store[$pid]['#link'] = new FormattableMarkup('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]);
1151 } 1151 }
1152 $build['fields'][$pid] = $store[$pid]; 1152 $build['fields'][$pid] = $store[$pid];
1153 } 1153 }
1154 } 1154 }
1155 } 1155 }