public function ViewUIConverter::convert in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/views_ui/src/ParamConverter/ViewUIConverter.php \Drupal\views_ui\ParamConverter\ViewUIConverter::convert()
- 8.0 core/modules/views_ui/src/ProxyClass/ParamConverter/ViewUIConverter.php \Drupal\views_ui\ProxyClass\ParamConverter\ViewUIConverter::convert()
Same name and namespace in other branches
- 8 core/modules/views_ui/src/ParamConverter/ViewUIConverter.php \Drupal\views_ui\ParamConverter\ViewUIConverter::convert()
Converts path variables to their corresponding objects.
Parameters
mixed $value: The raw value.
mixed $definition: The parameter definition provided in the route options.
string $name: The name of the parameter.
array $defaults: The route defaults array.
Return value
mixed|null The converted parameter value.
Overrides EntityConverter::convert
File
- core/
modules/ views_ui/ src/ ParamConverter/ ViewUIConverter.php, line 59 - Contains \Drupal\views_ui\ParamConverter\ViewUIConverter.
Class
- ViewUIConverter
- Provides upcasting for a view entity to be used in the Views UI.
Namespace
Drupal\views_ui\ParamConverterCode
public function convert($value, $definition, $name, array $defaults) {
if (!($entity = parent::convert($value, $definition, $name, $defaults))) {
return;
}
// Get the temp store for this variable if it needs one. Attempt to load the
// view from the temp store, synchronize its status with the existing view,
// and store the lock metadata.
$store = $this->tempStoreFactory
->get('views');
if ($view = $store
->get($value)) {
if ($entity
->status()) {
$view
->enable();
}
else {
$view
->disable();
}
$view->lock = $store
->getMetadata($value);
}
else {
$view = new ViewUI($entity);
}
return $view;
}