MenuLinkFieldForm.php in Menu Link (Field) 8
File
src/Plugin/Menu/Form/MenuLinkFieldForm.php
View source
<?php
namespace Drupal\menu_link\Plugin\Menu\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Menu\Form\MenuLinkDefaultForm;
class MenuLinkFieldForm extends MenuLinkDefaultForm {
protected $menuLink;
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;
}
}