Пример #1
0
 /**
  * Returns the form to edit a view.
  *
  * @param \Drupal\views_ui\ViewUI $view
  *   The view to be edited.
  * @param string|null $display_id
  *   (optional) The display ID being edited. Defaults to NULL, which will load
  *   the first available display.
  *
  * @return array
  *   An array containing the Views edit and preview forms.
  */
 public function edit(ViewUI $view, $display_id = NULL)
 {
     $name = $view->label();
     $data = $this->viewsData->get($view->get('base_table'));
     if (isset($data['table']['base']['title'])) {
         $name .= ' (' . $data['table']['base']['title'] . ')';
     }
     $build['#title'] = $name;
     $build['edit'] = $this->entityFormBuilder()->getForm($view, 'edit', array('display_id' => $display_id));
     $build['preview'] = $this->entityFormBuilder()->getForm($view, 'preview', array('display_id' => $display_id));
     return $build;
 }
Пример #2
0
 /**
  * Placeholder function for overriding $display['display_title'].
  *
  * @todo Remove this function once editing the display title is possible.
  */
 public function getDisplayLabel(ViewUI $view, $display_id, $check_changed = TRUE)
 {
     $display = $view->get('display');
     $title = $display_id == 'default' ? $this->t('Master') : $display[$display_id]['display_title'];
     $title = views_ui_truncate($title, 25);
     if ($check_changed && !empty($view->changed_display[$display_id])) {
         $changed = '*';
         $title = $title . $changed;
     }
     return $title;
 }