function FieldUiTestTrait::getFieldFromGroup
Same name in other branches
- 10 core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::getFieldFromGroup()
Helper function that returns the name of the group that a field is in.
Parameters
string $field_type: The name of the field type.
Return value
string|null Group name
3 calls to FieldUiTestTrait::getFieldFromGroup()
- FieldUiJSTestTrait::fieldUIAddNewFieldJS in core/
modules/ field_ui/ tests/ src/ Traits/ FieldUiJSTestTrait.php - Creates a new field through the Field UI.
- FieldUiTestTrait::fieldUIAddNewField in core/
modules/ field_ui/ tests/ src/ Traits/ FieldUiTestTrait.php - Creates a new field through the Field UI.
- ManageFieldsFunctionalTest::testHiddenFields in core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php - Tests that Field UI respects the 'no_ui' flag in the field type definition.
File
-
core/
modules/ field_ui/ tests/ src/ Traits/ FieldUiTestTrait.php, line 189
Class
- FieldUiTestTrait
- Provides common functionality for the Field UI test classes.
Namespace
Drupal\Tests\field_ui\TraitsCode
public function getFieldFromGroup($field_type) {
/** @var \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager */
$field_type_plugin_manager = \Drupal::service('plugin.manager.field.field_type');
$grouped_field_types = $field_type_plugin_manager->getGroupedDefinitions($field_type_plugin_manager->getUiDefinitions());
foreach ($grouped_field_types as $group => $field_types) {
if (array_key_exists($field_type, $field_types)) {
return $group;
}
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.