class ConfigActionsList in Config Actions 8
Plugin for handling a list of source locations.
Plugin annotation
@ConfigActionsSource(
id = "list",
description = @Translation("List of sources."),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\config_actions\ConfigActionsSourceBase implements ConfigActionsSourceInterface, ContainerFactoryPluginInterface
- class \Drupal\config_actions\Plugin\ConfigActionsSource\ConfigActionsList
- class \Drupal\config_actions\ConfigActionsSourceBase implements ConfigActionsSourceInterface, ContainerFactoryPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ConfigActionsList
File
- src/
Plugin/ ConfigActionsSource/ ConfigActionsList.php, line 15
Namespace
Drupal\config_actions\Plugin\ConfigActionsSourceView source
class ConfigActionsList extends ConfigActionsSourceBase {
/**
* Return True if array is Sequential
* @param array $arr
* @return bool
*/
protected function isSequential($arr) {
if (array() === $arr) {
return false;
}
return is_array($arr) && array_keys($arr) == range(0, count($arr) - 1);
}
/**
* {@inheritdoc}
*/
public function detect($source) {
return $this
->isSequential($source);
}
/**
* {@inheritdoc}
*/
public function doLoad() {
$data = [];
// Loop through sources and pick first success
foreach ($this->sourceId as $source) {
$data = $this->actionService
->loadSource($source, '', $this->sourceBase);
if (!empty($data)) {
break;
}
}
return $data;
}
/**
* {@inheritdoc}
*/
public function doSave($data) {
$result = FALSE;
// Loop through sources and pick first success
foreach ($this->sourceId as $source) {
$result = $this->actionService
->saveSource($data, $source, '', $this->sourceBase);
if ($result) {
break;
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigActionsList:: |
public | function |
Determine if $source is valid for the specific plugin. Overrides ConfigActionsSourceBase:: |
|
ConfigActionsList:: |
public | function |
Load data from the source. Overrides ConfigActionsSourceBase:: |
|
ConfigActionsList:: |
public | function |
Save data to the source. Overrides ConfigActionsSourceBase:: |
|
ConfigActionsList:: |
protected | function | Return True if array is Sequential | |
ConfigActionsSourceBase:: |
protected | property | ||
ConfigActionsSourceBase:: |
protected | property | Determine if sourceData has been changed since last load/save. | |
ConfigActionsSourceBase:: |
protected | property | ||
ConfigActionsSourceBase:: |
protected | property | The type of the plugin instance | |
ConfigActionsSourceBase:: |
protected | property | The Base namespace for the source. Plugin specific. | |
ConfigActionsSourceBase:: |
protected | property | The cached config data for this source instance. | |
ConfigActionsSourceBase:: |
protected | property | The ID value of the source. Plugin specific. | |
ConfigActionsSourceBase:: |
public static | function |
Create a plugin instance from the container Overrides ContainerFactoryPluginInterface:: |
3 |
ConfigActionsSourceBase:: |
public | function |
Get the data cached from the last load/save. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Return whether the data from this source will be merged Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Return the type of plugin. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Return TRUE if the data has changed since the last load. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Load data from the source. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Save data to the source. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Set the data cached in this plugin instance.
Causes the plugin to be marked as Changed. Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Set whether data saved in this source should be merged with existing data Overrides ConfigActionsSourceInterface:: |
|
ConfigActionsSourceBase:: |
public | function |
Constructs a new ConfigActionsSource plugin object. Overrides PluginBase:: |
3 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |