You are here

protected function TestSocialSimpleTestBase::removeComponentViewDisplay in Social simple 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/TestSocialSimpleTestBase.php \Drupal\Tests\social_simple\Functional\TestSocialSimpleTestBase::removeComponentViewDisplay()

Remove 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::removeComponentViewDisplay()
TestSocialSimpleTest::testSocialSimple in tests/src/Functional/TestSocialSimpleTest.php
Test the social simple module for node and block.

File

tests/src/Functional/TestSocialSimpleTestBase.php, line 184

Class

TestSocialSimpleTestBase
Provides common helper methods for Social simple module tests.

Namespace

Drupal\Tests\social_simple\Functional

Code

protected function removeComponentViewDisplay($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
      ->removeComponent($field_name)
      ->save();
  }
}