You are here

function facets_form_facets_facet_form_alter in Facets 8

Implements hook_form_FORM_ID_alter().

File

./facets.module, line 350
Contains facets.module.

Code

function facets_form_facets_facet_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $facet_sources = [];
  foreach (\Drupal::service('plugin.manager.facets.facet_source')
    ->getDefinitions() as $facet_source_id => $definition) {
    $facet_sources[$definition['id']] = !empty($definition['label']) ? $definition['label'] : $facet_source_id;
  }
  if (count($facet_sources) == 0) {
    unset($form['actions']);
  }
}