function MenuLinkContent::getPluginDefinition

Same name in other branches
  1. 9 core/modules/menu_link_content/src/Entity/MenuLinkContent.php \Drupal\menu_link_content\Entity\MenuLinkContent::getPluginDefinition()
  2. 10 core/modules/menu_link_content/src/Entity/MenuLinkContent.php \Drupal\menu_link_content\Entity\MenuLinkContent::getPluginDefinition()
  3. 11.x core/modules/menu_link_content/src/Entity/MenuLinkContent.php \Drupal\menu_link_content\Entity\MenuLinkContent::getPluginDefinition()

Overrides MenuLinkContentInterface::getPluginDefinition

1 call to MenuLinkContent::getPluginDefinition()
MenuLinkContent::postSave in core/modules/menu_link_content/src/Entity/MenuLinkContent.php
Acts on a saved entity before the insert or update hook is invoked.

File

core/modules/menu_link_content/src/Entity/MenuLinkContent.php, line 151

Class

MenuLinkContent
Defines the menu link content entity class.

Namespace

Drupal\menu_link_content\Entity

Code

public function getPluginDefinition() {
    $definition = [];
    $definition['class'] = 'Drupal\\menu_link_content\\Plugin\\Menu\\MenuLinkContent';
    $definition['menu_name'] = $this->getMenuName();
    if ($url_object = $this->getUrlObject()) {
        $definition['url'] = NULL;
        $definition['route_name'] = NULL;
        $definition['route_parameters'] = [];
        if (!$url_object->isRouted()) {
            $definition['url'] = $url_object->getUri();
        }
        else {
            $definition['route_name'] = $url_object->getRouteName();
            $definition['route_parameters'] = $url_object->getRouteParameters();
        }
        $definition['options'] = $url_object->getOptions();
    }
    $definition['title'] = $this->getTitle();
    $definition['description'] = $this->getDescription();
    $definition['weight'] = $this->getWeight();
    $definition['id'] = $this->getPluginId();
    $definition['metadata'] = [
        'entity_id' => $this->id(),
    ];
    $definition['form_class'] = '\\Drupal\\menu_link_content\\Form\\MenuLinkContentForm';
    $definition['enabled'] = $this->isEnabled() ? 1 : 0;
    $definition['expanded'] = $this->isExpanded() ? 1 : 0;
    $definition['provider'] = 'menu_link_content';
    $definition['discovered'] = 0;
    $definition['parent'] = $this->getParentId();
    return $definition;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.