You are here

public function ConditionalFieldsFormHelper::hasConditionalFields in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 src/ConditionalFieldsFormHelper.php \Drupal\conditional_fields\ConditionalFieldsFormHelper::hasConditionalFields()

Determine whether the form has conditional fields.

1 call to ConditionalFieldsFormHelper::hasConditionalFields()
ConditionalFieldsFormHelper::afterBuild in src/ConditionalFieldsFormHelper.php
An after_build callback for forms with dependencies.

File

src/ConditionalFieldsFormHelper.php, line 280

Class

ConditionalFieldsFormHelper
Helper to interact with forms.

Namespace

Drupal\conditional_fields

Code

public function hasConditionalFields() {

  // Dependencies data is attached in
  // conditional_fields_element_after_build().
  if (empty($this->form['#conditional_fields'])) {
    return FALSE;
  }
  if (!method_exists($this->form_state
    ->getFormObject(), 'getFormDisplay')) {
    return FALSE;
  }
  return TRUE;
}