You are here

function scheduled_publish_form_views_exposed_form_alter in Scheduled Publish 8.3

Implements hook_form_FORM_ID_alter().

File

./scheduled_publish.module, line 164
Contains scheduled_publish.module.

Code

function scheduled_publish_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // Turn scheduled publish view moderation state filter
  // into a select with available options from node workflows.
  $view = $form_state
    ->getStorage('view');
  if ($view['view']
    ->id() == 'scheduled_publish') {
    if (isset($form['moderation_state'])) {
      $options = [
        '' => t('- Any -'),
      ];
      $options = array_merge($options, scheduled_publish_get_node_workflow_states());
      $form['moderation_state']['#type'] = 'select';
      $form['moderation_state']['#options'] = $options;
      unset($form['moderation_state']['#size']);
    }
  }
}