function EntityDisplayDependenciesTest::addFieldsToDisplay
Adds fields to an entity display.
Parameters
array $dependent_fields: An array of field names to configure on the display, mapped to module names to be used as dependencies.
\Drupal\Core\Entity\Display\EntityDisplayInterface $display: An entity display to configure and test.
File
-
core/
modules/ field_ui/ tests/ src/ Kernel/ EntityDisplayDependenciesTest.php, line 105
Class
- EntityDisplayDependenciesTest
- Tests dependencies of entity displays.
Namespace
Drupal\Tests\field_ui\KernelCode
protected function addFieldsToDisplay(array $dependent_fields, EntityDisplayInterface $display) : void {
foreach ($dependent_fields as $field_name => $dependency) {
$display->setComponent($field_name, [
'type' => 'test_field_dynamic_dependencies',
'weight' => 0,
'settings' => [
'dependent_module' => $dependency,
],
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.