public function PageVariantSelectionForm::add in Page Manager 8
Same name and namespace in other branches
- 8.4 page_manager_ui/src/Form/PageVariantSelectionForm.php \Drupal\page_manager_ui\Form\PageVariantSelectionForm::add()
Overrides ManageConditions::add
File
- page_manager_ui/
src/ Form/ PageVariantSelectionForm.php, line 80 - Contains \Drupal\page_manager_ui\Form\PageVariantSelectionForm.
Class
Namespace
Drupal\page_manager_ui\FormCode
public function add(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
$page_variant = $cached_values['page_variant'];
$condition = $form_state
->getValue('conditions');
$content = \Drupal::formBuilder()
->getForm($this
->getConditionClass(), $condition, $this
->getTempstoreId(), $this->machine_name, $page_variant
->id());
$content['#attached']['library'][] = 'core/drupal.dialog.ajax';
list(, $route_parameters) = $this
->getOperationsRouteInfo($cached_values, $this->machine_name, $form_state
->getValue('conditions'));
$content['submit']['#attached']['drupalSettings']['ajax'][$content['submit']['#id']]['url'] = $this
->url($this
->getAddRoute($cached_values), $route_parameters, [
'query' => [
FormBuilderInterface::AJAX_FORM_REQUEST => TRUE,
],
]);
$response = new AjaxResponse();
$response
->addCommand(new OpenModalDialogCommand($this
->t('Configure Required Context'), $content, array(
'width' => '700',
)));
return $response;
}