You are here

acquia_contenthub.module in Acquia Content Hub 8.2

Same filename and directory in other branches
  1. 8 acquia_contenthub.module

Drupal Module: Acquia Content Hub.

Content Hub is a cloud-based, centralized content distribution and syndication solution that provides you with the ability to share and enrich content throughout a network of content sources (including Drupal websites) with extensible, open APIs. It is a high-performance, scalable offering that connects content bi-directionally across multiple systems. It enables enterprises that operate many digital properties the ability to effectively publish, reuse, and syndicate content across a variety of content sources and publishing channels.

File

acquia_contenthub.module
View source
<?php

/**
 * @file
 * Drupal Module: Acquia Content Hub.
 *
 * Content Hub is a cloud-based, centralized content distribution and
 * syndication solution that provides you with the ability to share and enrich
 * content throughout a network of content sources (including Drupal websites)
 * with extensible, open APIs. It is a high-performance, scalable offering that
 * connects content bi-directionally across multiple systems. It enables
 * enterprises that operate many digital properties the ability to effectively
 * publish, reuse, and syndicate content across a variety of content sources
 * and publishing channels.
 */
use Drupal\Core\Entity\EntityInterface;
use Drupal\acquia_contenthub\Plugin\Field\AcquiaContentHubGenerateNullFieldItemList;
use Drupal\acquia_contenthub\Plugin\Field\AcquiaContentHubModerationStateFieldItemList;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function acquia_contenthub_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.acquia_contenthub':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Some info about Acquia Content Hub') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_entity_base_field_info_alter().
 */
function acquia_contenthub_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {
  if (!empty($fields['moderation_state'])) {
    $fields['moderation_state']
      ->setClass(AcquiaContentHubModerationStateFieldItemList::class);
  }
  if ($entity_type
    ->id() === 'paragraph') {
    $fields['parent_id']
      ->setClass(AcquiaContentHubGenerateNullFieldItemList::class);
    $fields['parent_type']
      ->setClass(AcquiaContentHubGenerateNullFieldItemList::class);
    $fields['parent_field_name']
      ->setClass(AcquiaContentHubGenerateNullFieldItemList::class);
  }
  if ($entity_type
    ->id() === 'webform_submission') {
    $fields['entity_type']
      ->setClass(AcquiaContentHubGenerateNullFieldItemList::class);
  }
}