public function MobileNumberFieldTest::updateWidgetSetting in Mobile Number 8
Same name and namespace in other branches
- 2.0.x src/Tests/MobileNumberFieldTest.php \Drupal\mobile_number\Tests\MobileNumberFieldTest::updateWidgetSetting()
Updates a field widget setting.
Parameters
string $name: Name of content type.
string $setting: Setting key.
mixed $value: Value.
File
- src/
Tests/ MobileNumberFieldTest.php, line 417
Class
- MobileNumberFieldTest
- Mobile number field functionality.'.
Namespace
Drupal\mobile_number\TestsCode
public function updateWidgetSetting($name, $setting, $value) {
/** @var \Drupal\field\FieldConfigInterface $field */
$form_display = EntityFormDisplay::load('node.' . $name . '.default');
$component = $form_display
->getComponent("field_{$name}");
$component['settings'][$setting] = $value;
$form_display
->setComponent("field_{$name}", $component);
$form_display
->save();
}