public function PageEditWizard::getOperations in Page Manager 8
Same name and namespace in other branches
- 8.4 page_manager_ui/src/Wizard/PageEditWizard.php \Drupal\page_manager_ui\Wizard\PageEditWizard::getOperations()
Retrieve a list of FormInterface classes by their step key in the wizard.
Parameters
mixed $cached_values: The values returned by $this->getTempstore()->get($this->getMachineName()); *.
Return value
array An associative array keyed on the step name with an array value with the following keys:
- title (string): Human-readable title of the step.
- form (string): Fully-qualified class name of the form for this step.
- values (array): Optional array of cached values to override when on this step.
- validate (array): Optional array of callables to be called when this step is validated.
- submit (array): Optional array of callables to be called when this step is submitted.
Overrides PageWizardBase::getOperations
File
- page_manager_ui/
src/ Wizard/ PageEditWizard.php, line 27 - Contains \Drupal\page_manager_ui\Wizard\PageEditWizard.
Class
Namespace
Drupal\page_manager_ui\WizardCode
public function getOperations($cached_values) {
$operations = parent::getOperations($cached_values);
/** @var $page \Drupal\page_manager\Entity\Page */
$page = $cached_values['page'];
if (!empty($page)) {
// Get variants and re-sort by weight or remove variants if the user
// has edited the variant.
$variants = $page
->getVariants();
if (!empty($cached_values['deleted_variants'])) {
foreach (array_keys($cached_values['deleted_variants']) as $page_variant_id) {
// @todo There's a bug that adds non-variants to the deleted_variants
// key in the cached_values. This has something to do with adding a
// block_page variant to a page in tempstore that's already had a
// variant previously deleted and then reordering the blocks in a
// region. It's pretty weird, and as we rebuild that UI, I suspect it
// will go away, but the keys aren't manipulated, so we use them
// instead of the entity.
unset($variants[$page_variant_id]);
}
}
// Suppress errors because of https://bugs.php.net/bug.php?id=50688.
@uasort($variants, '\\Drupal\\page_manager\\Entity\\PageVariant::sort');
foreach ($variants as $page_variant) {
$page_variant
->setPageEntity($page);
foreach ($this
->getVariantOperations($page_variant, $cached_values) as $name => $operation) {
$operation['values']['page_variant'] = $page_variant;
$operation['breadcrumbs'] = [
$this
->t('Variants'),
$page_variant
->label() ?: $this
->t('Variant'),
];
$operations['page_variant__' . $page_variant
->id() . '__' . $name] = $operation;
}
}
}
return $operations;
}