You are here

protected function EditUpdateForm::getScheduledFields in Scheduled Publish 8.3

Returns scheduled publish fields

Parameters

string $entityTypeName:

string $bundleName:

Return value

array

1 call to EditUpdateForm::getScheduledFields()
EditUpdateForm::buildForm in src/Form/EditUpdateForm.php
Form constructor.

File

src/Form/EditUpdateForm.php, line 132
Contains \Drupal\scheduled_publish\Form\EditUpdateForm.

Class

EditUpdateForm

Namespace

Drupal\scheduled_publish\Form

Code

protected function getScheduledFields(string $entityTypeName, string $bundleName) : array {
  $scheduledFields = [];
  $fields = \Drupal::service('entity_field.manager')
    ->getFieldDefinitions($entityTypeName, $bundleName);
  foreach ($fields as $fieldName => $field) {

    /** @var FieldConfig $field */
    if (strpos($fieldName, 'field_') !== FALSE) {
      if ($field
        ->getType() === 'scheduled_publish') {
        $scheduledFields[] = $fieldName;
      }
    }
  }
  return $scheduledFields;
}