Commit 0ad74d11 authored by alexpott's avatar alexpott

Issue #2274175 by tim.plunkett, vijaycs85: Block plugin schema should be...

Issue #2274175 by tim.plunkett, vijaycs85: Block plugin schema should be defined separately from the entity.
parent 7354180b
...@@ -253,3 +253,42 @@ config_entity: ...@@ -253,3 +253,42 @@ config_entity:
dependencies: dependencies:
type: config_dependencies type: config_dependencies
label: 'Dependencies' label: 'Dependencies'
block_settings:
type: mapping
label: 'Block settings'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Description'
label_display:
type: string
label: 'Display title'
cache:
type: mapping
label: 'Cache settings'
mapping:
max_age:
type: integer
label: 'Maximum age'
contexts:
type: sequence
label: 'Vary by context'
sequence:
- type: string
label: 'Context'
status:
type: boolean
label: 'Status'
info:
type: label
label: 'Admin info'
view_mode:
type: string
label: 'View mode'
provider:
type: string
label: 'Provider'
...@@ -36,3 +36,14 @@ aggregator.settings: ...@@ -36,3 +36,14 @@ aggregator.settings:
list_max: list_max:
type: integer type: integer
label: 'Number of items shown in listing pages' label: 'Number of items shown in listing pages'
block.settings.aggregator_feed_block:
type: block_settings
label: 'Aggregator feed block'
mapping:
block_count:
type: integer
label: 'Block count'
feed:
type: string
label: 'Feed'
...@@ -54,37 +54,7 @@ block.block.*: ...@@ -54,37 +54,7 @@ block.block.*:
type: string type: string
label: 'Plugin' label: 'Plugin'
settings: settings:
type: mapping type: block.settings.[%parent.plugin]
label: 'Block settings'
mapping: block.settings.*:
label: type: block_settings
type: label
label: 'Description'
label_display:
type: string
label: 'Display title'
cache:
type: mapping
label: 'Cache settings'
mapping:
max_age:
type: integer
label: 'Maximum age'
contexts:
type: sequence
label: 'Vary by context'
sequence:
- type: string
label: 'Context'
status:
type: boolean
label: 'Status'
info:
type: label
label: 'Admin info'
view_mode:
type: string
label: 'View mode'
provider:
type: string
label: 'Provider'
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockConfigSchemaTest.
*/
namespace Drupal\block\Tests;
use Drupal\block\Entity\Block;
use Drupal\config\Tests\ConfigSchemaTestBase;
/**
* Tests the block config schema.
*/
class BlockConfigSchemaTest extends ConfigSchemaTestBase {
/**
* {@inheritdoc}
*/
public static $modules = array('block', 'aggregator', 'book', 'custom_block', 'forum', 'statistics');
/**
* The typed config manager.
*
* @var \Drupal\Core\Config\TypedConfigManagerInterface
*/
protected $typedConfig;
/**
* The block manager.
*
* @var \Drupal\block\BlockManagerInterface
*/
protected $blockManager;
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Block config schema',
'description' => '',
'group' => 'Block',
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->typedConfig = \Drupal::service('config.typed');
$this->blockManager = \Drupal::service('plugin.manager.block');
}
/**
* Tests the block config schema for block plugins.
*/
public function testBlockConfigSchema() {
foreach ($this->blockManager->getDefinitions() as $block_id => $definition) {
$id = strtolower($this->randomName());
$block = Block::create(array(
'id' => $id,
'theme' => 'stark',
'weight' => 00,
'status' => TRUE,
'region' => 'content',
'plugin' => $block_id,
'settings' => array(
'label' => $this->randomName(),
'provider' => 'system',
'label_display' => FALSE,
),
'visibility' => array(),
));
$block->save();
$config = \Drupal::config("block.block.$id");
$this->assertEqual($config->get('id'), $id);
$this->assertConfigSchema($this->typedConfig, $config->getName(), $config->get());
}
}
}
...@@ -24,3 +24,11 @@ book.settings: ...@@ -24,3 +24,11 @@ book.settings:
child_type: child_type:
type: string type: string
label: 'Content type for child pages' label: 'Content type for child pages'
block.settings.book_navigation:
type: block_settings
label: 'Book navigation block'
mapping:
block_mode:
type: string
label: 'Block display mode'
...@@ -38,3 +38,29 @@ forum.settings: ...@@ -38,3 +38,29 @@ forum.settings:
vocabulary: vocabulary:
type: string type: string
label: 'Forum vocabulary ID' label: 'Forum vocabulary ID'
block.settings.forum_active_block:
type: block_settings
label: 'Active forum topics block'
mapping:
properties:
type: sequence
label: 'Properties'
sequence:
- type: string
block_count:
type: integer
label: 'Block count'
block.settings.forum_new_block:
type: block_settings
label: 'New forum topics block'
mapping:
properties:
type: sequence
label: 'Properties'
sequence:
- type: string
block_count:
type: integer
label: 'Block count'
...@@ -129,3 +129,11 @@ action.configuration.node_unpublish_by_keyword_action: ...@@ -129,3 +129,11 @@ action.configuration.node_unpublish_by_keyword_action:
sequence: sequence:
- type: sequence - type: sequence
label: 'Keyword' label: 'Keyword'
block.settings.node_syndicate_block:
type: block_settings
label: 'Syndicate block'
mapping:
block_count:
type: integer
label: 'Block count'
...@@ -338,3 +338,17 @@ system.mail: ...@@ -338,3 +338,17 @@ system.mail:
system.theme.global: system.theme.global:
type: theme_settings type: theme_settings
label: 'Theme global settings' label: 'Theme global settings'
block.settings.system_branding_block:
type: block_settings
label: 'Branding block'
mapping:
use_site_logo:
type: boolean
label: 'Use site logo'
use_site_name:
type: boolean
label: 'Use site name'
use_site_slogan:
type: boolean
label: 'Use site slogan'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment