You are here

function search_api_federated_solr_field_widget_form in Search API Federated Solr 7.3

Same name and namespace in other branches
  1. 7 search_api_federated_solr.module \search_api_federated_solr_field_widget_form()
  2. 7.2 search_api_federated_solr.module \search_api_federated_solr_field_widget_form()

Implements hook_field_widget_form().

File

./search_api_federated_solr.module, line 618
search_api_federated_solr.module Contains hook implementations for the Federated Solr Search API Module.

Code

function search_api_federated_solr_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $value = isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL;
  $widget = $element;
  $widget['#delta'] = $delta;
  if ($instance['widget']['type'] == 'federated_terms_textfield') {
    $widget += array(
      '#type' => 'textfield',
      '#default_value' => $value,
      '#description' => t('This federated term is used as a facet value in your search application.  It should consist of a hierarchy made up of a type (i.e. "Condition") and term (i.e. "Diabetes"), separated by ">".  For example: Condition>Diabetes.'),
      '#size' => 75,
      '#maxlength' => 255,
      '#attributes' => [
        'class' => [
          'js-text-full',
          'text-full',
        ],
      ],
    );
  }
  $element['value'] = $widget;
  return $element;
}