You are here

function scheduled_publish_get_fields in Scheduled Publish 8.2

Same name and namespace in other branches
  1. 8 scheduled_publish.module \scheduled_publish_get_fields()
1 call to scheduled_publish_get_fields()
scheduled_publish_form_alter in ./scheduled_publish.module
Implements hook_form_alter

File

./scheduled_publish.module, line 41
Contains scheduled_publish.module.

Code

function scheduled_publish_get_fields(string $entityTypeName, string $key) : array {
  $fields = \Drupal::service('entity_field.manager')
    ->getFieldDefinitions($entityTypeName, $key);
  $scheduledFields = [];
  foreach ($fields as $fieldName => $field) {
    if (strpos($fieldName, 'field_') !== FALSE) {
      if ($field
        ->getType() === 'scheduled_publish') {
        $scheduledFields[] = $fieldName;
      }
    }
  }
  return $scheduledFields;
}