You are here

public function MenuLinkConfigMapper::populateFromRequest in Config menu link 8

File

src/MenuLinkConfigMapper.php, line 28
Contains \Drupal\menu_link_config\MenuLinkConfigMapper.

Class

MenuLinkConfigMapper
Provides configuration mapper for configuration menu links.

Namespace

Drupal\menu_link_config

Code

public function populateFromRequest(Request $request) {

  // We cannot call the parent implementation because the request does not
  // have a 'menu_link_config' attribute, so we have to duplicate
  // ConfigNamesMapper::populateFromRequest() here.
  if ($request->attributes
    ->has('langcode')) {
    $this->langcode = $request->attributes
      ->get('langcode');
  }
  else {
    $this->langcode = NULL;
  }

  /** @var \Drupal\menu_link_config\Plugin\Menu\MenuLinkConfig $plugin */
  $plugin = $request->attributes
    ->get('menu_link_plugin');
  $this
    ->setEntity($plugin
    ->getEntity());
}