layoutPluginManager example

/** * Gets the layout plugin for this section. * * @param \Drupal\Core\Plugin\Context\ContextInterface[] $contexts * An array of available contexts. * * @return \Drupal\Core\Layout\LayoutInterface * The layout plugin. */
  public function getLayout(array $contexts = []) {
    $layout = $this->layoutPluginManager()->createInstance($this->getLayoutId()$this->layoutSettings);
    if ($contexts) {
      $this->contextHandler()->applyContextMapping($layout$contexts);
    }
    return $layout;
  }

  /** * Gets the layout plugin ID for this section. * * @return string * The layout plugin ID. * * @internal * This method should only be used by code responsible for storing the data. */
Home | Imprint | This part of the site doesn't use cookies.