summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules')
-rw-r--r--core/modules/image/src/ImageEffectBase.php12
-rw-r--r--core/modules/locale/src/StringDatabaseStorage.php5
-rw-r--r--core/modules/locale/tests/src/Kernel/LocaleStringTest.php23
-rw-r--r--core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php25
-rw-r--r--core/modules/workflows/src/Plugin/WorkflowTypeBase.php20
5 files changed, 35 insertions, 50 deletions
diff --git a/core/modules/image/src/ImageEffectBase.php b/core/modules/image/src/ImageEffectBase.php
index 58be370c1e6e..745976133be7 100644
--- a/core/modules/image/src/ImageEffectBase.php
+++ b/core/modules/image/src/ImageEffectBase.php
@@ -3,7 +3,7 @@
namespace Drupal\image;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\Plugin\PluginBase;
+use Drupal\Core\Plugin\ConfigurablePluginBase;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\image\ImageEffectManager
* @see plugin_api
*/
-abstract class ImageEffectBase extends PluginBase implements ImageEffectInterface, ContainerFactoryPluginInterface {
+abstract class ImageEffectBase extends ConfigurablePluginBase implements ImageEffectInterface, ContainerFactoryPluginInterface {
/**
* The image effect ID.
@@ -46,7 +46,6 @@ abstract class ImageEffectBase extends PluginBase implements ImageEffectInterfac
public function __construct(array $configuration, $plugin_id, $plugin_definition, LoggerInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
- $this->setConfiguration($configuration);
$this->logger = $logger;
}
@@ -154,13 +153,6 @@ abstract class ImageEffectBase extends PluginBase implements ImageEffectInterfac
/**
* {@inheritdoc}
*/
- public function defaultConfiguration() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function calculateDependencies() {
return [];
}
diff --git a/core/modules/locale/src/StringDatabaseStorage.php b/core/modules/locale/src/StringDatabaseStorage.php
index f023d1968ae7..75c73411978d 100644
--- a/core/modules/locale/src/StringDatabaseStorage.php
+++ b/core/modules/locale/src/StringDatabaseStorage.php
@@ -527,7 +527,10 @@ class StringDatabaseStorage implements StringStorageInterface {
protected function dbDelete($table, $keys) {
$query = $this->connection->delete($table, $this->options);
foreach ($keys as $field => $value) {
- $query->condition($field, $value);
+ if (!is_array($value)) {
+ $value = [$value];
+ }
+ $query->condition($field, $value, 'IN');
}
return $query;
}
diff --git a/core/modules/locale/tests/src/Kernel/LocaleStringTest.php b/core/modules/locale/tests/src/Kernel/LocaleStringTest.php
index f5f27b01a627..b007c7ab55b0 100644
--- a/core/modules/locale/tests/src/Kernel/LocaleStringTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleStringTest.php
@@ -258,4 +258,27 @@ class LocaleStringTest extends KernelTestBase {
])->save();
}
+ /**
+ * Tests that strings are correctly deleted.
+ */
+ public function testDeleteStrings(): void {
+ $source = $this->storage->createString([
+ 'source' => 'Revision ID',
+ ])->save();
+
+ $this->storage->createTranslation([
+ 'lid' => $source->lid,
+ 'language' => 'fr',
+ 'translation' => 'Translated Revision ID',
+ ])->save();
+
+ // Confirm that the string has been created.
+ $this->assertNotEmpty($this->storage->findString(['lid' => $source->lid]));
+
+ $this->storage->deleteStrings(['lid' => $source->lid]);
+
+ // Confirm that the string has been deleted.
+ $this->assertEmpty($this->storage->findString(['lid' => $source->lid]));
+ }
+
}
diff --git a/core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php b/core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php
index 7ad95f16823b..acc2e49a5cb6 100644
--- a/core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php
+++ b/core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php
@@ -2,14 +2,16 @@
namespace Drupal\search\Plugin;
-use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Plugin\ConfigurableTrait;
/**
* Provides a base implementation for a configurable Search plugin.
*/
abstract class ConfigurableSearchPluginBase extends SearchPluginBase implements ConfigurableSearchPluginInterface {
+ use ConfigurableTrait;
+
/**
* The unique ID for the search page using this plugin.
*
@@ -29,27 +31,6 @@ abstract class ConfigurableSearchPluginBase extends SearchPluginBase implements
/**
* {@inheritdoc}
*/
- public function defaultConfiguration() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getConfiguration() {
- return $this->configuration;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setConfiguration(array $configuration) {
- $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $configuration);
- }
-
- /**
- * {@inheritdoc}
- */
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
diff --git a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
index 47488b38801b..e86b77a22857 100644
--- a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
+++ b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
@@ -2,7 +2,7 @@
namespace Drupal\workflows\Plugin;
-use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Plugin\ConfigurablePluginBase;
use Drupal\Core\Plugin\PluginWithFormsTrait;
use Drupal\workflows\State;
use Drupal\workflows\StateInterface;
@@ -16,7 +16,7 @@ use Drupal\workflows\WorkflowTypeInterface;
*
* @see \Drupal\workflows\Annotation\WorkflowType
*/
-abstract class WorkflowTypeBase extends PluginBase implements WorkflowTypeInterface {
+abstract class WorkflowTypeBase extends ConfigurablePluginBase implements WorkflowTypeInterface {
use PluginWithFormsTrait;
@@ -28,14 +28,6 @@ abstract class WorkflowTypeBase extends PluginBase implements WorkflowTypeInterf
/**
* {@inheritdoc}
*/
- public function __construct(array $configuration, $plugin_id, $plugin_definition) {
- parent::__construct($configuration, $plugin_id, $plugin_definition);
- $this->setConfiguration($configuration);
- }
-
- /**
- * {@inheritdoc}
- */
public function label() {
$definition = $this->getPluginDefinition();
// The label can be an object.
@@ -60,15 +52,9 @@ abstract class WorkflowTypeBase extends PluginBase implements WorkflowTypeInterf
/**
* {@inheritdoc}
*/
- public function getConfiguration() {
- return $this->configuration;
- }
-
- /**
- * {@inheritdoc}
- */
public function setConfiguration(array $configuration) {
$this->configuration = $configuration + $this->defaultConfiguration();
+ return $this;
}
/**