Loading core/lib/Drupal/Core/Annotation/ContextDefinition.php +1 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Drupal\Core\Annotation; use Drupal\Component\Annotation\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * @defgroup plugin_context Annotation for context definition Loading Loading @@ -106,7 +105,7 @@ public function __construct(array $values) { // used in the classes they pass to. foreach (['label', 'description'] as $key) { // @todo Remove this workaround in https://www.drupal.org/node/2362727. if (isset($values[$key]) && $values[$key] instanceof TranslatableMarkup) { if (isset($values[$key]) && $values[$key] instanceof Translation) { $values[$key] = (string) $values[$key]->get(); } else { Loading core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * admin_label = @Translation("Test context-aware block"), * context_definitions = { * "user" = @ContextDefinition("entity:user", required = FALSE, * constraints = { "NotNull" = {} } * label = @Translation("User Context"), constraints = { "NotNull" = {} } * ), * } * ) Loading core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ public function testConstraints() { $this->assertArrayHasKey('user', $definition['context_definitions']); $this->assertInstanceOf(ContextDefinition::class, $definition['context_definitions']['user']); $this->assertEquals(['NotNull' => []], $definition['context_definitions']['user']->getConstraints()); $this->assertEquals("User Context", $definition['context_definitions']['user']->getLabel()); } } Loading
core/lib/Drupal/Core/Annotation/ContextDefinition.php +1 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace Drupal\Core\Annotation; use Drupal\Component\Annotation\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * @defgroup plugin_context Annotation for context definition Loading Loading @@ -106,7 +105,7 @@ public function __construct(array $values) { // used in the classes they pass to. foreach (['label', 'description'] as $key) { // @todo Remove this workaround in https://www.drupal.org/node/2362727. if (isset($values[$key]) && $values[$key] instanceof TranslatableMarkup) { if (isset($values[$key]) && $values[$key] instanceof Translation) { $values[$key] = (string) $values[$key]->get(); } else { Loading
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * admin_label = @Translation("Test context-aware block"), * context_definitions = { * "user" = @ContextDefinition("entity:user", required = FALSE, * constraints = { "NotNull" = {} } * label = @Translation("User Context"), constraints = { "NotNull" = {} } * ), * } * ) Loading
core/tests/Drupal/KernelTests/Core/Plugin/Annotation/ContextDefinitionTest.php +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ public function testConstraints() { $this->assertArrayHasKey('user', $definition['context_definitions']); $this->assertInstanceOf(ContextDefinition::class, $definition['context_definitions']['user']); $this->assertEquals(['NotNull' => []], $definition['context_definitions']['user']->getConstraints()); $this->assertEquals("User Context", $definition['context_definitions']['user']->getLabel()); } }