protected function TestSocialSimpleTestBase::setComponentViewDisplay in Social simple 2.0.x
Same name and namespace in other branches
- 8 tests/src/Functional/TestSocialSimpleTestBase.php \Drupal\Tests\social_simple\Functional\TestSocialSimpleTestBase::setComponentViewDisplay()
Set 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.
1 call to TestSocialSimpleTestBase::setComponentViewDisplay()
- TestSocialSimpleTest::testSocialSimple in tests/
src/ Functional/ TestSocialSimpleTest.php - Test the social simple module for node and block.
File
- tests/
src/ Functional/ TestSocialSimpleTestBase.php, line 152
Class
- TestSocialSimpleTestBase
- Provides common helper methods for Social simple module tests.
Namespace
Drupal\Tests\social_simple\FunctionalCode
protected function setComponentViewDisplay($form_display_id, $entity_type, $bundle, $mode, $field_name) {
// Set entity 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)
->save();
}
}