protected DialogRenderer::determineTargetSelector(array &$options, RouteMatchInterface $route_match)
Determine the target selector for the OpenDialogCommand.
Parameters
array &$options: The 'target' option, if set, is used, and then removed from $options.
RouteMatchInterface $route_match: When no 'target' option is set in $options, $route_match is used instead to determine the target.
Return value
string The target selector.
File
- core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php, line 72
Class
- DialogRenderer
- Default main content renderer for dialog requests.
Namespace
Drupal\Core\Render\MainContent
Code
protected function determineTargetSelector(array &$options, RouteMatchInterface $route_match) {
// Generate the target wrapper for the dialog.
if (isset($options['target'])) {
// If the target was nominated in the incoming options, use that.
$target = $options['target'];
// Ensure the target includes the #.
if (substr($target, 0, 1) != '#') {
$target = '#' . $target;
}
// This shouldn't be passed on to jQuery.ui.dialog.
unset($options['target']);
}
else {
// Generate a target based on the route id.
$route_name = $route_match->getRouteName();
$target = '#' . Html::getUniqueId("drupal-dialog-$route_name");
}
return $target;
}
Please login to continue.