<?php

/**
 * @file
 *
 */

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Form\FormStateInterface;

const PEOPLE_FINDER_STAFF = 'people_finder_staff';

/**
 * Implements hook_help().
 */
function pe_profile_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.profile':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The User profile module manages different profiles for users') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Creating and managing profiles') . '</dt>';
      $output .= '<dd>' . t('TODO:') . '</dd>';
      $output .= '</dl>';
      return $output;
  }
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function pe_profile_form_views_exposed_form_alter(&$form, FormStateInterface $form_state) {
  if ($form_state->getStorage()['view']->storage->id() == PEOPLE_FINDER_STAFF) {
    $form['field_academic_value']['#validated'] = TRUE;
    $form['field_academic_value']['#options'][0] = t('Non-academic');
    $form['field_academic_value']['#options'][1] = t('Academic');
  }
}
