You are here

class EntityChannelsAttribute in Acquia Content Hub 8.2

Notates the metadata with a CDF version marker.

Hierarchy

  • class \Drupal\acquia_contenthub\EventSubscriber\CdfAttributes\EntityChannelsAttribute implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of EntityChannelsAttribute

1 string reference to 'EntityChannelsAttribute'
acquia_contenthub.services.yml in ./acquia_contenthub.services.yml
acquia_contenthub.services.yml
1 service uses EntityChannelsAttribute
entity.channels.cdf.attribute in ./acquia_contenthub.services.yml
Drupal\acquia_contenthub\EventSubscriber\CdfAttributes\EntityChannelsAttribute

File

src/EventSubscriber/CdfAttributes/EntityChannelsAttribute.php, line 13

Namespace

Drupal\acquia_contenthub\EventSubscriber\CdfAttributes
View source
class EntityChannelsAttribute implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[AcquiaContentHubEvents::POPULATE_CDF_ATTRIBUTES][] = [
      'onPopulateAttributes',
      100,
    ];
    return $events;
  }

  /**
   * Documents entity languages as an attribute.
   *
   * @param \Drupal\acquia_contenthub\Event\CdfAttributesEvent $event
   *   The event being dispatched.
   *
   * @throws \Exception
   */
  public function onPopulateAttributes(CdfAttributesEvent $event) {
    $cdf = $event
      ->getCdf();
    $cdf
      ->addAttribute('channels', CDFAttribute::TYPE_ARRAY_REFERENCE, []);
    $cdf
      ->getAttribute('channels')
      ->setValue([]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityChannelsAttribute::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
EntityChannelsAttribute::onPopulateAttributes public function Documents entity languages as an attribute.