ensureLayout example


  protected function doGetLayout($layout_id, array $layout_settings) {
    return \Drupal::service('plugin.manager.core.layout')->createInstance($layout_id$layout_settings);
  }

  /** * Overrides \Drupal\Core\Entity\EntityDisplayBase::init(). */
  protected function init() {
    $this->ensureLayout();
    parent::init();
  }

  /** * Overrides \Drupal\Core\Entity\EntityDisplayBase::preSave(). */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);

    // Ensure the plugin configuration is updated. Once layouts are no longer     // stored as third party settings, this will be handled by the code in
Home | Imprint | This part of the site doesn't use cookies.