You are here

public function ContentModerationIPEAccess::applies in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/IPEAccess/ContentModerationIPEAccess.php \Drupal\lightning_workflow\Plugin\IPEAccess\ContentModerationIPEAccess::applies()
  2. 8 src/Plugin/IPEAccess/ContentModerationIPEAccess.php \Drupal\lightning_workflow\Plugin\IPEAccess\ContentModerationIPEAccess::applies()

File

src/Plugin/IPEAccess/ContentModerationIPEAccess.php, line 54

Class

ContentModerationIPEAccess
Plugin annotation @IPEAccess( id = "content_moderation_ipe", label = @Translation("Content moderation") )

Namespace

Drupal\lightning_workflow\Plugin\IPEAccess

Code

public function applies(PanelsDisplayVariant $display) {
  $contexts = $display
    ->getContexts();
  if (empty($contexts['@panelizer.entity_context:entity'])) {
    return FALSE;
  }
  $context = $contexts['@panelizer.entity_context:entity'];
  if ($context
    ->hasContextValue()) {
    return $this->information
      ->isModeratedEntity($context
      ->getContextValue());
  }
  else {
    return FALSE;
  }
}