You are here

public function MenuLinkItem::getMenuPluginId in Menu Link (Field) 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldType/MenuLinkItem.php \Drupal\menu_link\Plugin\Field\FieldType\MenuLinkItem::getMenuPluginId()

Generates the plugin ID for the associated menu link.

Parameters

string $langcode: (optional) The langcode to take into account.

Return value

string The Plugin ID.

3 calls to MenuLinkItem::getMenuPluginId()
MenuLinkItem::delete in src/Plugin/Field/FieldType/MenuLinkItem.php
Defines custom delete behavior for field values.
MenuLinkItem::doSave in src/Plugin/Field/FieldType/MenuLinkItem.php
Saves the plugin definition.
MenuLinkItem::getMenuPluginDefinition in src/Plugin/Field/FieldType/MenuLinkItem.php
Generates the plugin definition of the associated menu link.

File

src/Plugin/Field/FieldType/MenuLinkItem.php, line 265

Class

MenuLinkItem
Defines a menu link field type which stores the link, parent and menu.

Namespace

Drupal\menu_link\Plugin\Field\FieldType

Code

public function getMenuPluginId($langcode = NULL) {
  if ($langcode === NULL) {
    $menu_link_per_translation = $this
      ->getSetting('menu_link_per_translation');
    $langcode = $menu_link_per_translation ? $this
      ->getLangcode() : LanguageInterface::LANGCODE_NOT_SPECIFIED;
  }
  $field_name = $this->definition
    ->getFieldDefinition()
    ->getName();
  $entity_type_id = $this
    ->getEntity()
    ->getEntityTypeId();
  return 'menu_link_field:' . "{$entity_type_id}_{$field_name}_{$this->getEntity()->uuid()}_{$langcode}";
}