protected function IefTableViewModeTestTrait::configureWidget in Inline Entity Form Table View Mode 8.2
Configure a field with the widget of this module.
Parameters
string $entity_type_id: The entity type id to configure.
string $bundle: The bundle name to configure.
string $field_name: The field name to configure.
string $form_mode: The form mode to configure the widget.
Throws
\Drupal\Core\Entity\EntityStorageException
2 calls to IefTableViewModeTestTrait::configureWidget()
- ComplexTableViewModeWidgetTest::testWidgetBehaviorBeforeAndAfterConfigureTheViewModeIef in tests/
src/ FunctionalJavascript/ ComplexTableViewModeWidgetTest.php - Test the widget behavior before and after configure the view mode ief.
- IefTableViewModeTestTrait::configureFieldAndWidget in tests/
src/ Traits/ IefTableViewModeTestTrait.php - Create an entity reference field and configure it with the widget.
File
- tests/
src/ Traits/ IefTableViewModeTestTrait.php, line 76
Class
- IefTableViewModeTestTrait
- Provides common functionality for the IEF table view mode test classes.
Namespace
Drupal\Tests\ief_table_view_mode\TraitsCode
protected function configureWidget($entity_type_id, $bundle, $field_name, $form_mode = 'default') {
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = \Drupal::service('entity_display.repository');
$form_display = $display_repository
->getFormDisplay($entity_type_id, $bundle);
$component = $form_display
->getComponent($field_name);
$component['type'] = 'inline_entity_form_complex_table_view_mode';
$display_repository
->getFormDisplay($entity_type_id, $bundle)
->setComponent($field_name, $component)
->save();
$this
->assertTrue(TRUE, new FormattableMarkup('The widget "Inline entity form - Complex - Table View Mode" is attached to the field %field_name.', [
'%field_name' => $field_name,
]));
}