public function OptionsButtons::getFieldName in Conditional Fields 4.x
Same name and namespace in other branches
- 8 src/Plugin/conditional_fields/handler/OptionsButtons.php \Drupal\conditional_fields\Plugin\conditional_fields\handler\OptionsButtons::getFieldName()
Get field name.
Parameters
array $field: The field object.
Return value
string|false The field name
1 call to OptionsButtons::getFieldName()
- OptionsButtons::checkBoxesHandler in src/
Plugin/ conditional_fields/ handler/ OptionsButtons.php - Return state for check boxes.
File
- src/
Plugin/ conditional_fields/ handler/ OptionsButtons.php, line 201
Class
- OptionsButtons
- Provides states handler for Check boxes/radio buttons.
Namespace
Drupal\conditional_fields\Plugin\conditional_fields\handlerCode
public function getFieldName(array $field) {
$field_name = FALSE;
if (isset($field['#name'])) {
$field_name = $field['#name'];
}
elseif (isset($field['#field_name'])) {
$field_name = $field['#field_name'];
}
elseif (isset($field['#array_parents']) && !empty($field['#array_parents'])) {
$field_name = $field['#parents'][0];
}
elseif (isset($field['#parents']) && is_array($field['#parents'])) {
$field_name = $field['#parents'][0];
}
return $field_name;
}