You are here

class MenuLinkFieldForm in Menu Link (Field) 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Menu/Form/MenuLinkFieldForm.php \Drupal\menu_link\Plugin\Menu\Form\MenuLinkFieldForm

Provides the menu link edit form for the field-based menu link.

Hierarchy

Expanded class hierarchy of MenuLinkFieldForm

1 file declares its use of MenuLinkFieldForm
MenuLinkItem.php in src/Plugin/Field/FieldType/MenuLinkItem.php

File

src/Plugin/Menu/Form/MenuLinkFieldForm.php, line 11

Namespace

Drupal\menu_link\Plugin\Menu\Form
View source
class MenuLinkFieldForm extends MenuLinkDefaultForm {

  /**
   * The Menu link.
   *
   * @var \Drupal\menu_link\Plugin\Menu\MenuLinkField
   */
  protected $menuLink;

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildConfigurationForm($form, $form_state);
    $entity = $this->menuLink
      ->getEntity();
    $form['info'] = [
      '#type' => 'item',
      '#title' => $this
        ->t('This link is provided by the %type: <a href="@url">@label</a>. The path cannot be edited.', [
        '%type' => $entity
          ->getEntityType()
          ->getLabel(),
        '@url' => $entity
          ->toUrl(),
        '@label' => $entity
          ->label(),
      ]),
    ];
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MenuLinkDefaultForm::$menuLinkManager protected property The menu link manager.
MenuLinkDefaultForm::$menuParentSelector protected property The parent form selector service.
MenuLinkDefaultForm::$moduleHandler protected property The module handler service.
MenuLinkDefaultForm::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
MenuLinkDefaultForm::extractFormValues public function Extracts a plugin definition from form values. Overrides MenuLinkFormInterface::extractFormValues 1
MenuLinkDefaultForm::setMenuLinkInstance public function Injects the menu link plugin instance. Overrides MenuLinkFormInterface::setMenuLinkInstance
MenuLinkDefaultForm::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
MenuLinkDefaultForm::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm
MenuLinkDefaultForm::__construct public function Constructs a new \Drupal\Core\Menu\Form\MenuLinkDefaultForm.
MenuLinkFieldForm::$menuLink protected property The Menu link. Overrides MenuLinkDefaultForm::$menuLink
MenuLinkFieldForm::buildConfigurationForm public function Form constructor. Overrides MenuLinkDefaultForm::buildConfigurationForm
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.