示例#1
0
 /**
  * Route title callback.
  *
  * @param \Drupal\system\MenuInterface $menu
  *   The menu entity.
  *
  * @return array
  *   The menu label as a render array.
  */
 public function menuTitle(MenuInterface $menu)
 {
     return ['#markup' => $menu->label(), '#allowed_tags' => Xss::getHtmlTagList()];
 }
示例#2
0
 /**
  * Route title callback.
  *
  * @param \Drupal\system\MenuInterface $menu
  *   The menu entity.
  *
  * @return string
  *   The menu label.
  */
 public function menuTitle(MenuInterface $menu)
 {
     return Xss::filter($menu->label());
 }
示例#3
0
 /**
  * Route title callback.
  *
  * @param \Drupal\system\MenuInterface $menu
  *   The menu entity.
  *
  * @return string
  *   The menu label.
  */
 public function menuTitle(MenuInterface $menu)
 {
     return SafeMarkup::xssFilter($menu->label());
 }
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = $this->plugin->buildConfigurationForm([], $form_state);
     // Move the menu levels section to the bottom.
     $form['menu_levels']['#weight'] = 100;
     $form['entity_form'] = ['#type' => 'details', '#title' => $this->t('Edit menu %label', array('%label' => $this->entity->label())), '#open' => TRUE];
     $form['entity_form'] += $this->getEntityForm($this->entity)->buildForm([], $form_state);
     // Print the menu link titles as text instead of a link.
     if (!empty($form['entity_form']['links']['links'])) {
         foreach (Element::children($form['entity_form']['links']['links']) as $child) {
             $title = $form['entity_form']['links']['links'][$child]['title'][1]['#title'];
             $form['entity_form']['links']['links'][$child]['title'][1] = ['#markup' => $title];
         }
     }
     // Change the header text.
     $form['entity_form']['links']['links']['#header'][0] = $this->t('Link');
     $form['entity_form']['links']['links']['#header'][1]['data'] = $this->t('On');
     // Remove the label, ID, description, and buttons from the entity form.
     unset($form['entity_form']['label'], $form['entity_form']['id'], $form['entity_form']['description'], $form['entity_form']['actions']);
     // Since the overview form is further nested than expected, update the
     // #parents. See \Drupal\menu_ui\MenuForm::form().
     $form_state->set('menu_overview_form_parents', ['settings', 'entity_form', 'links']);
     return $form;
 }