Commit c435ef8d authored by alexpott's avatar alexpott
Browse files

Issue #2062573 by claudiu.cristea, tim.plunkett, Xano: Change notice: Add...

Issue #2062573 by claudiu.cristea, tim.plunkett, Xano: Change notice: Add method defaultConfiguration() in ConfigurablePluginInterface.
parent 935013e9
......@@ -28,4 +28,12 @@ public function getConfiguration();
*/
public function setConfiguration(array $configuration);
/**
* Returns default configuration for this plugin.
*
* @return array
* An associative array with the default configuration.
*/
public function defaultConfiguration();
}
......@@ -22,15 +22,13 @@ abstract class ConfigurableActionBase extends ActionBase implements Configurable
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configuration += $this->getDefaultConfiguration();
$this->configuration += $this->defaultConfiguration();
}
/**
* Returns default configuration for this action.
*
* @return array
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
public function defaultConfiguration() {
return array();
}
......
......@@ -105,7 +105,7 @@ public function execute($entity = NULL) {
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
public function defaultConfiguration() {
return array(
'recipient' => '',
'subject' => '',
......
......@@ -87,7 +87,7 @@ public function execute($object = NULL) {
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
public function defaultConfiguration() {
return array(
'url' => '',
);
......
......@@ -61,7 +61,7 @@ public function execute($entity = NULL) {
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
public function defaultConfiguration() {
return array(
'message' => '',
);
......
......@@ -16,6 +16,13 @@
*/
abstract class AggregatorPluginSettingsBase extends PluginBase implements PluginFormInterface, ConfigurablePluginInterface {
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return array();
}
/**
* {@inheritdoc}
*/
......
......@@ -23,9 +23,9 @@
class AggregatorCategoryBlock extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
// By default, the block will contain 10 feed items.
return array(
'block_count' => 10,
......
......@@ -23,9 +23,9 @@
class AggregatorFeedBlock extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
// By default, the block will contain 10 feed items.
return array(
'block_count' => 10,
......
......@@ -75,9 +75,9 @@ public static function create(ContainerInterface $container, array $configuratio
}
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
return array(
'status' => TRUE,
'info' => '',
......
......@@ -27,7 +27,7 @@ abstract class BlockBase extends PluginBase implements BlockPluginInterface {
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configuration += $this->settings() + array(
$this->configuration += $this->defaultConfiguration() + array(
'label' => '',
'module' => $plugin_definition['module'],
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
......@@ -35,22 +35,6 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
);
}
/**
* Returns plugin-specific settings for the block.
*
* Block plugins only need to override this method if they override the
* defaults provided in BlockBase::settings().
*
* @return array
* An array of block-specific settings to override the defaults provided in
* BlockBase::settings().
*
* @see \Drupal\block\BlockBase::settings().
*/
public function settings() {
return array();
}
/**
* {@inheritdoc}
*/
......@@ -65,6 +49,13 @@ public function setConfiguration(array $configuration) {
$this->configuration = $configuration;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return array();
}
/**
* {@inheritdoc}
*/
......
......@@ -21,18 +21,6 @@
*/
interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormInterface, PluginInspectionInterface {
/**
* Returns the default settings for this block plugin.
*
* @return array
* An associative array of block settings for this block, keyed by the
* setting name.
*
* @todo Consider merging this with the general plugin configuration member
* variable and its getter/setter in http://drupal.org/node/1764380.
*/
public function settings();
/**
* Indicates whether the block should be shown.
*
......
......@@ -69,7 +69,7 @@ protected function defineOptions() {
* An array of block-specific settings to override the defaults provided in
* \Drupal\views\Plugin\Block\ViewsBlock::settings().
*
* @see \Drupal\views\Plugin\Block\ViewsBlock::settings().
* @see \Drupal\views\Plugin\Block\ViewsBlock::defaultConfiguration()
*/
public function blockSettings(array $settings) {
$settings['items_per_page'] = 'none';
......
......@@ -24,7 +24,7 @@ class TestBlockInstantiation extends BlockBase {
/**
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
return array(
'display_message' => 'no message set',
);
......
......@@ -22,11 +22,11 @@
class TestCacheBlock extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*
* Sets a different caching strategy for testing purposes.
*/
public function settings() {
public function defaultConfiguration() {
return array(
'cache' => DRUPAL_CACHE_PER_ROLE,
);
......
......@@ -20,11 +20,11 @@
class TestXSSTitleBlock extends TestCacheBlock {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*
* Sets a different caching strategy for testing purposes.
*/
public function settings() {
public function defaultConfiguration() {
return array(
'cache' => DRUPAL_NO_CACHE,
);
......
......@@ -22,9 +22,9 @@
class BookNavigationBlock extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
return array(
'cache' => DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE,
'block_mode' => "all pages",
......
......@@ -40,7 +40,7 @@ public function execute($comment = NULL) {
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
public function defaultConfiguration() {
return array(
'keywords' => array(),
);
......
......@@ -22,9 +22,9 @@
class RecentCommentsBlock extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
return array(
'block_count' => 10,
);
......
......@@ -106,6 +106,13 @@ public function getConfiguration() {
);
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return array();
}
/**
* {@inheritdoc}
*/
......
......@@ -15,9 +15,9 @@
abstract class ForumBlockBase extends BlockBase {
/**
* Overrides \Drupal\block\BlockBase::settings().
* {@inheritdoc}
*/
public function settings() {
public function defaultConfiguration() {
return array(
'cache' => DRUPAL_CACHE_CUSTOM,
'properties' => array(
......
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