Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -186,8 +186,6 @@ class BlockViewBuilder extends EntityViewBuilder {
|
|||
* A block config entity ID.
|
||||
* @param $view_mode
|
||||
* The view mode the block is being viewed in.
|
||||
* @param $langcode
|
||||
* The langcode the block is being viewed in.
|
||||
*
|
||||
* @return array
|
||||
* A render array with a #pre_render callback to render the block.
|
||||
|
|
|
@ -207,7 +207,6 @@ class BlockUiTest extends WebTestBase {
|
|||
$this->assertTrue(!empty($elements), 'The context-aware test block appears.');
|
||||
$definition = \Drupal::service('plugin.manager.block')->getDefinition('test_context_aware');
|
||||
$this->assertTrue(!empty($definition), 'The context-aware test block exists.');
|
||||
|
||||
$edit = [
|
||||
'region' => 'content',
|
||||
'settings[context_mapping][user]' => '@block_test.multiple_static_context:user2',
|
||||
|
@ -217,6 +216,15 @@ class BlockUiTest extends WebTestBase {
|
|||
$this->drupalGet('');
|
||||
$this->assertText('Test context-aware block');
|
||||
$this->assertRaw($expected_text);
|
||||
|
||||
// Test context mapping allows empty selection for optional contexts.
|
||||
$this->drupalGet('admin/structure/block/manage/testcontextawareblock');
|
||||
$edit = [
|
||||
'settings[context_mapping][user]' => '',
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Save block');
|
||||
$this->drupalGet('');
|
||||
$this->assertText('No context mapping selected.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,8 +61,6 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
|||
*
|
||||
* @param string $id
|
||||
* The block ID.
|
||||
* @param string $module
|
||||
* The module.
|
||||
* @param array $visibility
|
||||
* The block visibility settings.
|
||||
* @param string $region
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* - configuration: A list of the block's configuration values.
|
||||
* - label: The configured label for the block.
|
||||
* - label_display: The display settings for the label.
|
||||
* - module: The module that provided this block plugin.
|
||||
* - cache: The cache settings.
|
||||
* - provider: The module or other provider that provided this block plugin.
|
||||
* - Block plugin specific settings will also be stored here.
|
||||
* - content: The content of this block.
|
||||
* - attributes: array of HTML attributes populated by modules, intended to
|
||||
|
|
|
@ -16,7 +16,7 @@ use Drupal\Core\Block\BlockBase;
|
|||
* id = "test_context_aware",
|
||||
* admin_label = @Translation("Test context-aware block"),
|
||||
* context = {
|
||||
* "user" = @ContextDefinition("entity:user")
|
||||
* "user" = @ContextDefinition("entity:user", required = FALSE)
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ class TestContextAwareBlock extends BlockBase {
|
|||
return array(
|
||||
'#prefix' => '<div id="' . $this->getPluginId() . '--username">',
|
||||
'#suffix' => '</div>',
|
||||
'#markup' => $user->getUsername(),
|
||||
'#markup' => $user ? $user->getUsername() : 'No context mapping selected.' ,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\block_test\Plugin\Block\TestContextAwareBlock.
|
||||
* Contains \Drupal\block_test\Plugin\Block\TestContextAwareUnsatisfiedBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\block_test\Plugin\Block;
|
||||
|
|
Reference in a new issue