本文整理汇总了PHP中Drupal\Component\Utility\UrlHelper::buildQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper::buildQuery方法的具体用法?PHP UrlHelper::buildQuery怎么用?PHP UrlHelper::buildQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Utility\UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::buildQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHandleWithGetRequest
/**
* Tests onHandleException with a GET request.
*/
public function testHandleWithGetRequest()
{
$request = Request::create('/test', 'GET', array('name' => 'druplicon', 'pass' => '12345'));
$this->kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all()));
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new \Exception('foo'));
$this->exceptionListener->onKernelException($event);
$response = $event->getResponse();
$this->assertEquals('GET name=druplicon&pass=12345 ', $response->getContent() . " " . UrlHelper::buildQuery($request->request->all()));
}
示例2: get
/**
* {@inheritdoc}
*/
public function get()
{
if (!isset($this->destination)) {
$query = $this->requestStack->getCurrentRequest()->query;
if (UrlHelper::isExternal($query->get('destination'))) {
$this->destination = '/';
} elseif ($query->has('destination')) {
$this->destination = $query->get('destination');
} else {
$this->destination = $this->urlGenerator->generateFromRoute('<current>', [], ['query' => UrlHelper::buildQuery(UrlHelper::filterQueryParameters($query->all()))]);
}
}
return $this->destination;
}
示例3: createPlaceholder
/**
* {@inheritdoc}
*/
public function createPlaceholder(array $element)
{
$placeholder_render_array = array_intersect_key($element, ['#lazy_builder' => TRUE, '#cache' => TRUE]);
// Generate placeholder markup. Note that the only requirement is that this
// is unique markup that isn't easily guessable. The #lazy_builder callback
// and its arguments are put in the placeholder markup solely to simplify<<<
// debugging.
$callback = $placeholder_render_array['#lazy_builder'][0];
$arguments = UrlHelper::buildQuery($placeholder_render_array['#lazy_builder'][1]);
$token = hash('crc32b', serialize($placeholder_render_array));
$placeholder_markup = '<drupal-render-placeholder callback="' . Html::escape($callback) . '" arguments="' . Html::escape($arguments) . '" token="' . Html::escape($token) . '"></drupal-render-placeholder>';
// Build the placeholder element to return.
$placeholder_element = [];
$placeholder_element['#markup'] = Markup::create($placeholder_markup);
$placeholder_element['#attached']['placeholders'][$placeholder_markup] = $placeholder_render_array;
return $placeholder_element;
}
示例4: getServerLogoutUrl
/**
* Return the logout URL for the CAS server.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request, to provide base url context.
*
* @return string
* The fully constructed server logout URL.
*/
public function getServerLogoutUrl($request)
{
$base_url = $this->getServerBaseUrl() . 'logout';
if ($this->settings->get('redirection.logout_destination') != '') {
$destination = $this->settings->get('redirection.logout_destination');
if ($destination == '<front>') {
// If we have '<front>', resolve the path.
$params['service'] = $this->urlGenerator->generate($destination, array(), TRUE);
} elseif ($this->isExternal($destination)) {
// If we have an absolute URL, use that.
$params['service'] = $destination;
} else {
// This is a regular Drupal path.
$params['service'] = $request->getSchemeAndHttpHost() . '/' . ltrim($destination, '/');
}
return $base_url . '?' . UrlHelper::buildQuery($params);
} else {
return $base_url;
}
}
示例5: testHandleWithGetRequest
/**
* Tests onHandleException with a GET request.
*/
public function testHandleWithGetRequest()
{
$this->setupStubAliasManager();
$request = Request::create('/test', 'GET', array('name' => 'druplicon', 'pass' => '12345'));
$this->kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all()));
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));
$this->customPageSubscriber->onException($event);
$response = $event->getResponse();
$result = $response->getContent() . " " . UrlHelper::buildQuery($request->request->all());
$this->assertEquals('GET name=druplicon&pass=12345&destination=test&_exception_statuscode=404 ', $result);
}
示例6: buildLocalUrl
/**
* {@inheritdoc}
*/
protected function buildLocalUrl($uri, array $options = [], $collect_bubbleable_metadata = FALSE)
{
$generated_url = $collect_bubbleable_metadata ? new GeneratedUrl() : NULL;
$this->addOptionDefaults($options);
$request = $this->requestStack->getCurrentRequest();
// Remove the base: scheme.
// @todo Consider using a class constant for this in
// https://www.drupal.org/node/2417459
$uri = substr($uri, 5);
// Allow (outbound) path processing, if needed. A valid use case is the path
// alias overview form:
// @see \Drupal\path\Controller\PathController::adminOverview().
if (!empty($options['path_processing'])) {
// Do not pass the request, since this is a special case and we do not
// want to include e.g. the request language in the processing.
$uri = $this->pathProcessor->processOutbound($uri, $options, NULL, $generated_url);
}
// Strip leading slashes from internal paths to prevent them becoming
// external URLs without protocol. /example.com should not be turned into
// //example.com.
$uri = ltrim($uri, '/');
// Add any subdirectory where Drupal is installed.
$current_base_path = $request->getBasePath() . '/';
if ($options['absolute']) {
$current_base_url = $request->getSchemeAndHttpHost() . $current_base_path;
if (isset($options['https'])) {
if (!empty($options['https'])) {
$base = str_replace('http://', 'https://', $current_base_url);
$options['absolute'] = TRUE;
} else {
$base = str_replace('https://', 'http://', $current_base_url);
$options['absolute'] = TRUE;
}
} else {
$base = $current_base_url;
}
if ($collect_bubbleable_metadata) {
$generated_url->addCacheContexts(['url.site']);
}
} else {
$base = $current_base_path;
}
$prefix = empty($uri) ? rtrim($options['prefix'], '/') : $options['prefix'];
$uri = str_replace('%2F', '/', rawurlencode($prefix . $uri));
$query = $options['query'] ? '?' . UrlHelper::buildQuery($options['query']) : '';
$url = $base . $options['script'] . $uri . $query . $options['fragment'];
return $collect_bubbleable_metadata ? $generated_url->setGeneratedUrl($url) : $url;
}
示例7: testHandleWithGetRequest
/**
* Tests onHandleException with a GET request.
*/
public function testHandleWithGetRequest()
{
$request = Request::create('/test', 'GET', array('name' => 'druplicon', 'pass' => '12345'));
$request->attributes->set(AccessAwareRouterInterface::ACCESS_RESULT, AccessResult::forbidden()->addCacheTags(['druplicon']));
$this->kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all()));
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));
$this->customPageSubscriber->onException($event);
$response = $event->getResponse();
$result = $response->getContent() . " " . UrlHelper::buildQuery($request->request->all());
$this->assertEquals('GET name=druplicon&pass=12345&destination=test&_exception_statuscode=404 ', $result);
$this->assertEquals(AccessResult::forbidden()->addCacheTags(['druplicon', 'foo', 'bar']), $request->attributes->get(AccessAwareRouterInterface::ACCESS_RESULT));
}
示例8: renderAsLink
//.........这里部分代码省略.........
if (!isset($url['scheme'])) {
// There is no scheme, add the default 'http://' to the $path.
// Use the original $alter['path'] instead of the parsed version.
$path = "http://" . $alter['path'];
// Reset the $url array to include the new scheme.
$url = UrlHelper::parse($path);
}
}
if (isset($url['query'])) {
// Remove query parameters that were assigned a query string replacement
// token for which there is no value available.
foreach ($url['query'] as $param => $val) {
if ($val == '%' . $param) {
unset($url['query'][$param]);
}
// Replace any empty query params from URL parsing with NULL. So the
// query will get built correctly with only the param key.
// @see \Drupal\Component\Utility\UrlHelper::buildQuery().
if ($val === '') {
$url['query'][$param] = NULL;
}
}
$options['query'] = $url['query'];
}
if (isset($url['fragment'])) {
$path = strtr($path, array('#' . $url['fragment'] => ''));
// If the path is empty we want to have a fragment for the current site.
if ($path == '') {
$options['external'] = TRUE;
}
$options['fragment'] = $url['fragment'];
}
$alt = $this->viewsTokenReplace($alter['alt'], $tokens);
// Set the title attribute of the link only if it improves accessibility
if ($alt && $alt != $text) {
$options['attributes']['title'] = Html::decodeEntities($alt);
}
$class = $this->viewsTokenReplace($alter['link_class'], $tokens);
if ($class) {
$options['attributes']['class'] = array($class);
}
if (!empty($alter['rel']) && ($rel = $this->viewsTokenReplace($alter['rel'], $tokens))) {
$options['attributes']['rel'] = $rel;
}
// Not sure if this SafeMarkup::checkPlain() is needed here?
$target = SafeMarkup::checkPlain(trim($this->viewsTokenReplace($alter['target'], $tokens)));
if (!empty($target)) {
$options['attributes']['target'] = $target;
}
// Allow the addition of arbitrary attributes to links. Additional attributes
// currently can only be altered in preprocessors and not within the UI.
if (isset($alter['link_attributes']) && is_array($alter['link_attributes'])) {
foreach ($alter['link_attributes'] as $key => $attribute) {
if (!isset($options['attributes'][$key])) {
$options['attributes'][$key] = $this->viewsTokenReplace($attribute, $tokens);
}
}
}
// If the query and fragment were programmatically assigned overwrite any
// parsed values.
if (isset($alter['query'])) {
// Convert the query to a string, perform token replacement, and then
// convert back to an array form for _l().
$options['query'] = UrlHelper::buildQuery($alter['query']);
$options['query'] = $this->viewsTokenReplace($options['query'], $tokens);
$query = array();
parse_str($options['query'], $query);
$options['query'] = $query;
}
if (isset($alter['alias'])) {
// Alias is a boolean field, so no token.
$options['alias'] = $alter['alias'];
}
if (isset($alter['fragment'])) {
$options['fragment'] = $this->viewsTokenReplace($alter['fragment'], $tokens);
}
if (isset($alter['language'])) {
$options['language'] = $alter['language'];
}
// If the url came from entity_uri(), pass along the required options.
if (isset($alter['entity'])) {
$options['entity'] = $alter['entity'];
}
if (isset($alter['entity_type'])) {
$options['entity_type'] = $alter['entity_type'];
}
// The path has been heavily processed above, so it should be used as-is.
$final_url = CoreUrl::fromUri($path, $options);
// Build the link based on our altered Url object, adding on the optional
// prefix and suffix
$value = '';
if (!empty($alter['prefix'])) {
$value .= Xss::filterAdmin($this->viewsTokenReplace($alter['prefix'], $tokens));
}
$value .= $this->linkGenerator()->generate($text, $final_url);
if (!empty($alter['suffix'])) {
$value .= Xss::filterAdmin($this->viewsTokenReplace($alter['suffix'], $tokens));
}
return $value;
}
示例9: form
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state)
{
$form = parent::form($form, $form_state);
// We always show the internal path here.
/** @var \Drupal\Core\Url $url */
$url = $this->getEntity()->getUrlObject();
if ($url->isExternal()) {
$default_value = $url->toString();
} elseif ($url->getRouteName() == '<front>') {
// The default route for new entities is <front>, but we just want an
// empty form field.
$default_value = $this->getEntity()->isNew() ? '' : '<front>';
} else {
// @todo Url::getInternalPath() calls UrlGenerator::getPathFromRoute()
// which need a replacement since it is deprecated.
// https://www.drupal.org/node/2307061
$default_value = $url->getInternalPath();
// @todo Add a helper method to Url to render just the query string and
// fragment. https://www.drupal.org/node/2305013
$options = $url->getOptions();
if (isset($options['query'])) {
$default_value .= $options['query'] ? '?' . UrlHelper::buildQuery($options['query']) : '';
}
if (isset($options['fragment']) && $options['fragment'] !== '') {
$default_value .= '#' . $options['fragment'];
}
}
$form['url'] = array('#title' => $this->t('Link path'), '#type' => 'textfield', '#description' => $this->t('The path for this menu link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')), '#default_value' => $default_value, '#required' => TRUE, '#weight' => -2);
$language_configuration = $this->moduleHandler->invoke('language', 'get_default_configuration', array('menu_link_content', 'menu_link_content'));
if ($this->entity->isNew()) {
$default_language = isset($language_configuration['langcode']) ? $language_configuration['langcode'] : $this->languageManager->getDefaultLanguage()->getId();
} else {
$default_language = $this->entity->getUntranslated()->language()->getId();
}
$form['langcode'] = array('#title' => t('Language'), '#type' => 'language_select', '#default_value' => $default_language, '#languages' => Language::STATE_ALL, '#access' => !empty($language_configuration['language_show']));
$form['enabled'] = array('#type' => 'checkbox', '#title' => $this->t('Enable menu link'), '#description' => $this->t('Menu links that are not enabled will not be listed in any menu.'), '#default_value' => !$this->entity->isHidden(), '#weight' => 0);
$default = $this->entity->getMenuName() . ':' . $this->entity->getParentId();
$form['menu_parent'] = $this->menuParentSelector->parentSelectElement($default, $this->entity->getPluginId());
$form['menu_parent']['#weight'] = 10;
$form['menu_parent']['#title'] = $this->t('Parent link');
$form['menu_parent']['#description'] = $this->t('The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.');
$form['menu_parent']['#attributes']['class'][] = 'menu-title-select';
return $form;
}
示例10: testBuildQuery
/**
* Tests query building.
*
* @dataProvider providerTestBuildQuery
* @covers ::buildQuery
*
* @param array $query
* The array of query parameters.
* @param string $expected
* The expected query string.
* @param string $message
* The assertion message.
*/
public function testBuildQuery($query, $expected, $message)
{
$this->assertEquals(UrlHelper::buildQuery($query), $expected, $message);
}
示例11: generateFromPath
/**
* {@inheritdoc}
*/
public function generateFromPath($path = NULL, $options = array())
{
$request = $this->requestStack->getCurrentRequest();
$current_base_path = $request->getBasePath() . '/';
$current_base_url = $request->getSchemeAndHttpHost() . $current_base_path;
$current_script_path = '';
$base_path_with_script = $request->getBaseUrl();
if (!empty($base_path_with_script)) {
$script_name = $request->getScriptName();
if (strpos($base_path_with_script, $script_name) !== FALSE) {
$current_script_path = ltrim(substr($script_name, strlen($current_base_path)), '/') . '/';
}
}
// Merge in defaults.
$options += array('fragment' => '', 'query' => array(), 'absolute' => FALSE, 'prefix' => '');
if (!isset($options['external'])) {
// Return an external link if $path contains an allowed absolute URL. Only
// call the slow
// \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() if $path
// contains a ':' before any / ? or #. Note: we could use
// \Drupal\Component\Utility\UrlHelper::isExternal($path) here, but that
// would require another function call, and performance inside _url() is
// critical.
$colonpos = strpos($path, ':');
$options['external'] = $colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && UrlHelper::stripDangerousProtocols($path) == $path;
}
if (isset($options['fragment']) && $options['fragment'] !== '') {
$options['fragment'] = '#' . $options['fragment'];
}
if ($options['external']) {
// Split off the fragment.
if (strpos($path, '#') !== FALSE) {
list($path, $old_fragment) = explode('#', $path, 2);
// If $options contains no fragment, take it over from the path.
if (isset($old_fragment) && !$options['fragment']) {
$options['fragment'] = '#' . $old_fragment;
}
}
// Append the query.
if ($options['query']) {
$path .= (strpos($path, '?') !== FALSE ? '&' : '?') . UrlHelper::buildQuery($options['query']);
}
if (isset($options['https']) && $this->mixedModeSessions) {
if ($options['https'] === TRUE) {
$path = str_replace('http://', 'https://', $path);
} elseif ($options['https'] === FALSE) {
$path = str_replace('https://', 'http://', $path);
}
}
// Reassemble.
return $path . $options['fragment'];
} else {
$path = ltrim($this->processPath($path, $options), '/');
}
if (!isset($options['script'])) {
$options['script'] = $current_script_path;
}
// The base_url might be rewritten from the language rewrite in domain mode.
if (!isset($options['base_url'])) {
if (isset($options['https']) && $this->mixedModeSessions) {
if ($options['https'] === TRUE) {
$options['base_url'] = str_replace('http://', 'https://', $current_base_url);
$options['absolute'] = TRUE;
} elseif ($options['https'] === FALSE) {
$options['base_url'] = str_replace('https://', 'http://', $current_base_url);
$options['absolute'] = TRUE;
}
} else {
$options['base_url'] = $current_base_url;
}
} elseif (rtrim($options['base_url'], '/') == $options['base_url']) {
$options['base_url'] .= '/';
}
$base = $options['absolute'] ? $options['base_url'] : $current_base_path;
$prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
$path = str_replace('%2F', '/', rawurlencode($prefix . $path));
$query = $options['query'] ? '?' . UrlHelper::buildQuery($options['query']) : '';
return $base . $options['script'] . $path . $query . $options['fragment'];
}
示例12: buildLocalUrl
/**
* {@inheritdoc}
*/
protected function buildLocalUrl($uri, array $options = [])
{
$this->addOptionDefaults($options);
$request = $this->requestStack->getCurrentRequest();
// Remove the base:// scheme.
$uri = substr($uri, 7);
// Add any subdirectory where Drupal is installed.
$current_base_path = $request->getBasePath() . '/';
if ($options['absolute']) {
$current_base_url = $request->getSchemeAndHttpHost() . $current_base_path;
if (isset($options['https'])) {
if (!empty($options['https'])) {
$base = str_replace('http://', 'https://', $current_base_url);
$options['absolute'] = TRUE;
} else {
$base = str_replace('https://', 'http://', $current_base_url);
$options['absolute'] = TRUE;
}
} else {
$base = $current_base_url;
}
} else {
$base = $current_base_path;
}
$prefix = empty($uri) ? rtrim($options['prefix'], '/') : $options['prefix'];
$uri = str_replace('%2F', '/', rawurlencode($prefix . $uri));
$query = $options['query'] ? '?' . UrlHelper::buildQuery($options['query']) : '';
return $base . $options['script'] . $uri . $query . $options['fragment'];
}
示例13: ajaxView
/**
* Loads and renders a view via AJAX.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request object.
*
* @return \Drupal\views\Ajax\ViewAjaxResponse
* The view response as ajax response.
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* Thrown when the view was not found.
*/
public function ajaxView(Request $request)
{
$name = $request->request->get('view_name');
$display_id = $request->request->get('view_display_id');
if (isset($name) && isset($display_id)) {
$args = $request->request->get('view_args');
$args = isset($args) && $args !== '' ? explode('/', $args) : array();
// Arguments can be empty, make sure they are passed on as NULL so that
// argument validation is not triggered.
$args = array_map(function ($arg) {
return $arg == '' ? NULL : $arg;
}, $args);
$path = $request->request->get('view_path');
$dom_id = $request->request->get('view_dom_id');
$dom_id = isset($dom_id) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $dom_id) : NULL;
$pager_element = $request->request->get('pager_element');
$pager_element = isset($pager_element) ? intval($pager_element) : NULL;
$response = new ViewAjaxResponse();
// Remove all of this stuff from the query of the request so it doesn't
// end up in pagers and tablesort URLs.
foreach (array('view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', 'ajax_html_ids') as $key) {
$request->query->remove($key);
$request->request->remove($key);
}
// Load the view.
if (!($entity = $this->storage->load($name))) {
throw new NotFoundHttpException();
}
$view = $this->executableFactory->get($entity);
if ($view && $view->access($display_id)) {
$response->setView($view);
// Fix the current path for paging.
if (!empty($path)) {
$this->currentPath->setPath('/' . $path, $request);
}
// Add all POST data, because AJAX is always a post and many things,
// such as tablesorts, exposed filters and paging assume GET.
$request_all = $request->request->all();
$query_all = $request->query->all();
$request->query->replace($request_all + $query_all);
// Overwrite the destination.
// @see the redirect.destination service.
$origin_destination = $path;
$query = UrlHelper::buildQuery($request->query->all());
if ($query != '') {
$origin_destination .= '?' . $query;
}
$this->redirectDestination->set($origin_destination);
// Override the display's pager_element with the one actually used.
if (isset($pager_element)) {
$response->addCommand(new ScrollTopCommand(".view-dom-id-{$dom_id}"));
$view->displayHandlers->get($display_id)->setOption('pager_element', $pager_element);
}
// Reuse the same DOM id so it matches that in drupalSettings.
$view->dom_id = $dom_id;
if ($preview = $view->preview($display_id, $args)) {
$response->addCommand(new ReplaceCommand(".view-dom-id-{$dom_id}", $this->renderer->render($preview)));
$response->setAttachments($preview['#attached']);
}
return $response;
} else {
throw new AccessDeniedHttpException();
}
} else {
throw new NotFoundHttpException();
}
}
示例14: processOutbound
/**
* {@inheritdoc}
*/
public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL)
{
// If appropriate, process outbound to add a query parameter to the url and
// remove the language option, so that url negotiator does not rewrite the
// url.
// First, check if processing conditions are met.
if (!($request && !empty($options['route']) && $this->hasLowerLanguageNegotiationWeight() && $this->meetsContentEntityRoutesCondition($options['route'], $request))) {
return $path;
}
if (isset($options['language']) || ($langcode = $this->getLangcode($request))) {
// If the language option is set, unset it, so that the url language
// negotiator does not rewrite the url.
if (isset($options['language'])) {
$langcode = $options['language']->getId();
unset($options['language']);
}
if (isset($options['query']) && is_string($options['query'])) {
$query = [];
parse_str($options['query'], $query);
$options['query'] = $query;
} else {
$options['query'] = [];
}
if (!isset($options['query'][static::QUERY_PARAMETER])) {
$query_addon = [static::QUERY_PARAMETER => $langcode];
$options['query'] += $query_addon;
// @todo Remove this once https://www.drupal.org/node/2507005 lands.
$path .= (strpos($path, '?') !== FALSE ? '&' : '?') . UrlHelper::buildQuery($query_addon);
}
if ($bubbleable_metadata) {
// Cached URLs that have been processed by this outbound path
// processor must be:
$bubbleable_metadata->addCacheContexts(['url.query_args:' . static::QUERY_PARAMETER]);
}
}
return $path;
}
示例15: createBigPipeJsPlaceholder
/**
* Creates a BigPipe JS placeholder.
*
* @param string $original_placeholder
* The original placeholder.
* @param array $placeholder_render_array
* The render array for a placeholder.
*
* @return array
* The resulting BigPipe JS placeholder render array.
*/
protected static function createBigPipeJsPlaceholder($original_placeholder, array $placeholder_render_array)
{
// Generate a BigPipe selector (to be used by BigPipe's JavaScript).
// @see \Drupal\Core\Render\PlaceholderGenerator::createPlaceholder()
if (isset($placeholder_render_array['#lazy_builder'])) {
$callback = $placeholder_render_array['#lazy_builder'][0];
$arguments = $placeholder_render_array['#lazy_builder'][1];
$token = hash('crc32b', serialize($placeholder_render_array));
$big_pipe_js_selector = UrlHelper::buildQuery(['callback' => $callback, 'args' => $arguments, 'token' => $token]);
} else {
$big_pipe_js_selector = Html::getId($original_placeholder);
}
return ['#markup' => '<div data-big-pipe-selector="' . Html::escape($big_pipe_js_selector) . '"></div>', '#cache' => ['max-age' => 0, 'contexts' => ['session.exists']], '#attached' => ['library' => ['big_pipe/big_pipe'], 'drupalSettings' => ['bigPipePlaceholders' => [$big_pipe_js_selector => TRUE]], 'big_pipe_placeholders' => [Html::escape($big_pipe_js_selector) => $placeholder_render_array]]];
}