You are here

class CalendarSystemsBef in Calendar Systems 8.3

Adds date localization support to Bef.

Hierarchy

  • class \Drupal\calendar_systems_bef\Plugin\views\exposed_form\CalendarSystemsBef extends \Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters

Expanded class hierarchy of CalendarSystemsBef

1 file declares its use of CalendarSystemsBef
calendar_systems_bef.module in calendar_systems_bef/calendar_systems_bef.module

File

calendar_systems_bef/src/Plugin/views/exposed_form/CalendarSystemsBef.php, line 11

Namespace

Drupal\calendar_systems_bef\Plugin\views\exposed_form
View source
class CalendarSystemsBef extends BetterExposedFilters {
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
  }
  public function validateOptionsForm(&$form, FormStateInterface $form_state) {
    parent::validateOptionsForm($form, $form_state);
  }
  public function exposedFormAlter(&$form, FormStateInterface $form_state) {
    parent::exposedFormAlter($form, $form_state);
    if (_calendar_systems_factory()
      ->getCalendarName() !== 'persian') {
      return;
    }
    if (isset($form['#attached']['library'])) {
      $l = [];
      $found = FALSE;
      foreach ($form['#attached']['library'] as $lib) {
        if ($lib === 'core/jquery.ui.datepicker' || $lib === 'better_exposed_filters/datepickers') {
          $found = TRUE;
        }
        else {
          $l[] = $lib;
        }
      }
      $form['#attached']['library'] = $l;
      if ($found) {
        $form['#attached']['library'][] = 'calendar_systems_bef/picker';
      }
    }
  }

}

Members