protected function PbfBaseTest::setViewDisplay in Permissions by field 8
Set the widget for a component in a View display.
Parameters
string $form_display_id: The form display id.
string $entity_type: The entity type name.
string $bundle: The bundle name.
string $mode: The mode name.
string $field_name: The field name to set.
string $formatter_id: The formatter id to set.
array $settings: The settings of widget.
5 calls to PbfBaseTest::setViewDisplay()
- PbfBaseTest::attachPbfNodeFields in tests/
src/ Functional/ PbfBaseTest.php - Helper function to create and attach a Pbf Node field.
- PbfBaseTest::attachPbfRoleFields in tests/
src/ Functional/ PbfBaseTest.php - Helper function to create and attach a Pbf Role field.
- PbfBaseTest::attachPbfSynchronizedFields in tests/
src/ Functional/ PbfBaseTest.php - Helper function to create and attach a Pbf Node field synchronized.
- PbfBaseTest::attachPbfTermFields in tests/
src/ Functional/ PbfBaseTest.php - Attach Pbf fields which reference taxonomy terms.
- PbfBaseTest::attachPbfUserFields in tests/
src/ Functional/ PbfBaseTest.php - Attach Pbf fields which reference Users.
File
- tests/
src/ Functional/ PbfBaseTest.php, line 373
Class
- PbfBaseTest
- General setup and helper function for testing pbf module.
Namespace
Drupal\Tests\pbf\FunctionalCode
protected function setViewDisplay($form_display_id, $entity_type, $bundle, $mode = 'default', $field_name, $formatter_id, $settings) {
// Set article's view display.
$this->viewDisplay = EntityViewDisplay::load($form_display_id);
if (!$this->viewDisplay) {
EntityViewDisplay::create([
'targetEntityType' => $entity_type,
'bundle' => $bundle,
'mode' => $mode,
'status' => TRUE,
])
->save();
$this->viewDisplay = EntityViewDisplay::load($form_display_id);
}
if ($this->viewDisplay instanceof EntityViewDisplayInterface) {
$this->viewDisplay
->setComponent($field_name, [
'type' => $formatter_id,
'settings' => $settings,
])
->save();
}
}