You are here

function thunder_entity_base_field_info_alter in Thunder 8.2

Same name and namespace in other branches
  1. 8.3 thunder.profile \thunder_entity_base_field_info_alter()
  2. 8.4 thunder.profile \thunder_entity_base_field_info_alter()

Implements hook_entity_base_field_info_alter().

File

./thunder.profile, line 441
Enables modules and site configuration for a thunder site installation.

Code

function thunder_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {
  if (\Drupal::config('system.theme')
    ->get('admin') == 'thunder_admin' && \Drupal::hasService('content_moderation.moderation_information')) {

    /** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */
    $moderation_info = \Drupal::service('content_moderation.moderation_information');
    if ($moderation_info
      ->canModerateEntitiesOfEntityType($entity_type) && isset($fields['moderation_state'])) {
      $fields['moderation_state']
        ->setDisplayOptions('form', [
        'type' => 'thunder_moderation_state_default',
        'weight' => 100,
        'settings' => [],
      ]);
    }
  }
}