You are here

class PanelizerIPEController in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 src/Controller/PanelizerIPEController.php \Drupal\lightning_workflow\Controller\PanelizerIPEController
  2. 8 src/Controller/PanelizerIPEController.php \Drupal\lightning_workflow\Controller\PanelizerIPEController

Controller for Panels IPE routes that are specific to Panelizer.

Hierarchy

  • class \Drupal\lightning_workflow\Controller\PanelizerIPEController extends \Drupal\panelizer\Controller\PanelizerPanelsIPEController

Expanded class hierarchy of PanelizerIPEController

1 file declares its use of PanelizerIPEController
RouteSubscriber.php in src/Routing/RouteSubscriber.php

File

src/Controller/PanelizerIPEController.php, line 14

Namespace

Drupal\lightning_workflow\Controller
View source
class PanelizerIPEController extends PanelizerPanelsIPEController {

  /**
   * The moderation information service.
   *
   * @var \Drupal\content_moderation\ModerationInformationInterface
   */
  protected $modInfo;

  /**
   * PanelizerIPEController constructor.
   *
   * @param PanelizerInterface $panelizer
   *   The Panelizer service.
   * @param ModerationInformationInterface $mod_info
   *   The moderation information service.
   */
  public function __construct(PanelizerInterface $panelizer, ModerationInformationInterface $mod_info) {
    parent::__construct($panelizer);
    $this->modInfo = $mod_info;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('panelizer'), $container
      ->get('content_moderation.moderation_information'));
  }

  /**
   * {@inheritdoc}
   */
  public function revertToDefault(FieldableEntityInterface $entity, $view_mode) {
    if ($this->modInfo
      ->isModeratedEntity($entity)) {
      $entity = $this->modInfo
        ->getLatestRevision($entity
        ->getEntityTypeId(), $entity
        ->id());
    }
    return parent::revertToDefault($entity, $view_mode);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PanelizerIPEController::$modInfo protected property The moderation information service.
PanelizerIPEController::create public static function
PanelizerIPEController::revertToDefault public function
PanelizerIPEController::__construct public function PanelizerIPEController constructor.