You are here

trait ContentPublishingSettingsTrait in Acquia Lift Connector 8.4

Provides common methods for classes that involve publisher settings.

@package Drupal\acquia_lift_publisher\Form

Hierarchy

2 files declare their use of ContentPublishingSettingsTrait
EntityRenderHandler.php in modules/acquia_lift_publisher/src/EventSubscriber/Cdf/EntityRenderHandler.php
PublishOnlyRendered.php in modules/acquia_lift_publisher/src/EventSubscriber/Publish/PublishOnlyRendered.php

File

modules/acquia_lift_publisher/src/Form/ContentPublishingSettingsTrait.php, line 12

Namespace

Drupal\acquia_lift_publisher\Form
View source
trait ContentPublishingSettingsTrait {

  /**
   * Acquia lift publisher configuration object.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   * @see \Drupal\acquia_lift_publisher\Form\ContentPublishingForm
   */
  private $publisherSettings;

  /**
   * Returns the value of the entity view modes setting.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The current entity.
   *
   * @return array
   *   The setting value.
   */
  protected function getEntityViewModesSettingValue(EntityInterface $entity) : array {
    return $this->publisherSettings
      ->get("view_modes.{$entity->getEntityTypeId()}.{$entity->bundle()}") ?? [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentPublishingSettingsTrait::$publisherSettings private property Acquia lift publisher configuration object.
ContentPublishingSettingsTrait::getEntityViewModesSettingValue protected function Returns the value of the entity view modes setting.