hasMenuOverrides example


  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', ['%label' => $this->menu->label()]),
      '#open' => TRUE,
      '#access' => !$this->hasMenuOverrides() && $this->menu->access('edit'),
    ];
    $form['entity_form'] += $this->getEntityForm($this->menu)->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.
Home | Imprint | This part of the site doesn't use cookies.