function PluginBase::unpackOptions
Same name in other branches
- 9 core/modules/views/src/Plugin/views/PluginBase.php \Drupal\views\Plugin\views\PluginBase::unpackOptions()
- 8.9.x core/modules/views/src/Plugin/views/PluginBase.php \Drupal\views\Plugin\views\PluginBase::unpackOptions()
- 10 core/modules/views/src/Plugin/views/PluginBase.php \Drupal\views\Plugin\views\PluginBase::unpackOptions()
Overrides ViewsPluginInterface::unpackOptions
3 calls to PluginBase::unpackOptions()
- DisplayPluginBase::initDisplay in core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php - Initializes the display plugin.
- HandlerBase::init in core/
modules/ views/ src/ Plugin/ views/ HandlerBase.php - Initialize the plugin.
- PluginBase::init in core/
modules/ views/ src/ Plugin/ views/ PluginBase.php - Initialize the plugin.
File
-
core/
modules/ views/ src/ Plugin/ views/ PluginBase.php, line 224
Class
- PluginBase
- Base class for any views plugin types.
Namespace
Drupal\views\Plugin\viewsCode
public function unpackOptions(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE) {
if ($check && !is_array($options)) {
return;
}
if (!isset($definition)) {
$definition = $this->defineOptions();
}
foreach ($options as $key => $value) {
if (is_array($value)) {
// Ignore arrays with no definition.
if (!$all && empty($definition[$key])) {
continue;
}
if (!isset($storage[$key]) || !is_array($storage[$key])) {
$storage[$key] = [];
}
// If we're just unpacking our known options, and we're dropping an
// unknown array (as might happen for a dependent plugin fields) go
// ahead and drop that in.
if (!$all && isset($definition[$key]) && !isset($definition[$key]['contains'])) {
$storage[$key] = $value;
continue;
}
$this->unpackOptions($storage[$key], $value, $definition[$key]['contains'] ?? [], $all, FALSE);
}
elseif ($all || !empty($definition[$key])) {
$storage[$key] = $value;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.