Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
|
||||
/**
|
||||
* Implements hook_token_info().
|
||||
|
@ -68,9 +69,7 @@ function views_token_info() {
|
|||
/**
|
||||
* Implements hook_tokens().
|
||||
*/
|
||||
function views_tokens($type, $tokens, array $data = array(), array $options = array()) {
|
||||
$token_service = \Drupal::token();
|
||||
|
||||
function views_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['language'])) {
|
||||
$url_options['language'] = $options['language'];
|
||||
|
@ -83,6 +82,8 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
|
|||
/** @var \Drupal\views\ViewExecutable $view */
|
||||
$view = $data['view'];
|
||||
|
||||
$bubbleable_metadata->addCacheableDependency($view->storage);
|
||||
|
||||
foreach ($tokens as $name => $original) {
|
||||
switch ($name) {
|
||||
case 'label':
|
||||
|
@ -104,7 +105,8 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
|
|||
|
||||
case 'url':
|
||||
if ($url = $view->getUrl()) {
|
||||
$replacements[$original] = $url->setOptions($url_options)->toString();
|
||||
$replacements[$original] = $url->setOptions($url_options)
|
||||
->toString();
|
||||
}
|
||||
break;
|
||||
case 'base-table':
|
||||
|
@ -129,13 +131,6 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// [view:url:*] nested tokens. This only works if Token module is installed.
|
||||
if ($url_tokens = $token_service->findWithPrefix($tokens, 'url')) {
|
||||
if ($path = $view->getUrl()) {
|
||||
$replacements += $token_service->generate('url', $url_tokens, array('path' => $url->getInternalPath()), $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $replacements;
|
||||
|
|
Reference in a new issue