'url' => NULL,
'httpMethod' => 'POST',
'options' =>
['query' =>
[]],
'dialogType' => 'ajax',
];
if (array_key_exists('callback',
$settings) && !
isset($settings['url'
])) { $settings['url'
] = Url::
fromRoute('<current>'
);
// Add all the current query parameters in order to ensure that we build
// the same form on the AJAX POST requests. For example,
// \Drupal\user\AccountForm takes query parameters into account in order
// to hide the password field dynamically.
$settings['options'
]['query'
] += \Drupal::
request()->query->
all();
$settings['options'
]['query'
][FormBuilderInterface::AJAX_FORM_REQUEST
] = TRUE;
} // @todo Legacy support. Remove in Drupal 8.
if (isset($settings['method'
]) &&
$settings['method'
] == 'replace'
) { $settings['method'
] = 'replaceWith';
} // Convert \Drupal\Core\Url object to string.
if (isset($settings['url'
]) &&
$settings['url'
] instanceof Url
) { $url =
$settings['url'
]->
setOptions($settings['options'
])->
toString(TRUE
);