You are here

protected static function ConditionalFieldsFormHelper::getSelector in Conditional Fields 8

Same name and namespace in other branches
  1. 4.x src/ConditionalFieldsFormHelper.php \Drupal\conditional_fields\ConditionalFieldsFormHelper::getSelector()

Build a jQuery selector if it was not overridden by a custom value.

Note that this may be overridden later by a state handler.

1 call to ConditionalFieldsFormHelper::getSelector()
ConditionalFieldsFormHelper::processDependeeFields in src/ConditionalFieldsFormHelper.php
Determine and register dependee field effects.

File

src/ConditionalFieldsFormHelper.php, line 246

Class

ConditionalFieldsFormHelper
Helper to interact with forms.

Namespace

Drupal\conditional_fields

Code

protected static function getSelector($options_selector, $dependee_form_field) {
  if (!$options_selector) {
    $selector = conditional_fields_field_selector($dependee_form_field);
  }
  else {

    // Replace the language placeholder in the selector with current language.
    $selector = str_replace('%lang', $dependee_form_field['#language'], $options_selector);
  }
  return $selector;
}