entityTypeManager = $entity_type_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, $container->get('entity_type.manager') ); } /** * {@inheritdoc} */ public function evaluate() { $node = $this->getContextValue('node'); if (!$node && !$this->isNegated()) { return FALSE; } if ($node->isPublished() && !$this->isNegated()) { return TRUE; } return FALSE; } /** * {@inheritdoc} */ public function summary() { if (!empty($this->configuration['negate'])) { return $this->t('The node is not published.'); } else { return $this->t('The node is published.'); } } }