You are here

protected function InstanceSettingsTrait::setCollapsiblockBlockInstanceSetting in Collapsiblock 4.x

Same name and namespace in other branches
  1. 3.x tests/src/Traits/InstanceSettingsTrait.php \Drupal\Tests\collapsiblock\Traits\InstanceSettingsTrait::setCollapsiblockBlockInstanceSetting()

Set a specific Collapsiblock instance setting.

Parameters

\Drupal\block\BlockInterface $block: The block instance to change the setting in.

mixed $newValue: The new value for the setting.

string $key: The key of the setting to change. Will be automatically prefixed with '"third_party.collapsiblock.'.

10 calls to InstanceSettingsTrait::setCollapsiblockBlockInstanceSetting()
BlockInstanceTest::testBlockInstanceConfigOutput in tests/src/Functional/BlockInstanceTest.php
Test that block instance configuration is output to pages.
CollapseActionTest::testCollapsibleAlwaysCollapsed in tests/src/FunctionalJavascript/CollapseActionTest.php
Test the "Collapsible, collapsed all the time" Block Collapse Behavior.
CollapseActionTest::testCollapsibleAlwaysExpanded in tests/src/FunctionalJavascript/CollapseActionTest.php
Test the "Collapsible, expanded all the time" Block Collapse Behavior.
CollapseActionTest::testCollapsibleDefaultCollapsed in tests/src/FunctionalJavascript/CollapseActionTest.php
Test the "Collapsible, collapsed by default" Block Collapse Behavior.
CollapseActionTest::testCollapsibleDefaultExpanded in tests/src/FunctionalJavascript/CollapseActionTest.php
Test the "Collapsible, expanded by default" Block Collapse Behavior.

... See full list

File

tests/src/Traits/InstanceSettingsTrait.php, line 51

Class

InstanceSettingsTrait
Simplify working with Collapsiblock settings attached to a specific block.

Namespace

Drupal\Tests\collapsiblock\Traits

Code

protected function setCollapsiblockBlockInstanceSetting(BlockInterface $block, $newValue, $key = '') {
  $this
    ->config($block
    ->getConfigDependencyName())
    ->set("third_party_settings.collapsiblock.{$key}", $newValue)
    ->save();
}