You are here

function thunder_workflow_entity_base_field_info_alter in Thunder 8.5

Same name and namespace in other branches
  1. 6.2.x modules/thunder_workflow/thunder_workflow.module \thunder_workflow_entity_base_field_info_alter()
  2. 6.0.x modules/thunder_workflow/thunder_workflow.module \thunder_workflow_entity_base_field_info_alter()
  3. 6.1.x modules/thunder_workflow/thunder_workflow.module \thunder_workflow_entity_base_field_info_alter()

Implements hook_entity_base_field_info_alter().

File

modules/thunder_workflow/thunder_workflow.module, line 13
The install file.

Code

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

    /** @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' => [],
      ]);
    }
  }
}