Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -107,6 +107,11 @@ function contextual_help($route_name, RouteMatchInterface $route_match) {
* @see \Drupal\contextual\ContextualController::render()
*/
function contextual_preprocess(&$variables, $hook, $info) {
$variables['#cache']['contexts'][] = 'user.permissions';
if (!\Drupal::currentUser()->hasPermission('access contextual links')) {
return;
}
// Determine the primary theme function argument.
if (!empty($info['variables'])) {
$keys = array_keys($info['variables']);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\ContextualController.
*/
namespace Drupal\contextual;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Element\ContextualLinks.
*/
namespace Drupal\contextual\Element;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Element\ContextualLinksPlaceholder.
*/
namespace Drupal\contextual\Element;
use Drupal\Core\Template\Attribute;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Plugin\views\field\ContextualLinks.
*/
namespace Drupal\contextual\Plugin\views\field;
use Drupal\Component\Serialization\Json;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Tests\ContextualDynamicContextTest.
*/
namespace Drupal\contextual\Tests;
use Drupal\Component\Serialization\Json;
@ -105,6 +100,12 @@ class ContextualDynamicContextTest extends WebTestBase {
$this->assertIdentical($json[$ids[2]], '<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/3/edit">Edit</a></li></ul>');
$this->assertIdentical($json[$ids[3]], '');
// Verify that link language is properly handled.
$node3->addTranslation('it')->set('title', $this->randomString())->save();
$id = 'node:node=' . $node3->id() . ':changed=' . $node3->getChangedTime() . '&langcode=it';
$this->drupalGet('node', ['language' => ConfigurableLanguage::createFromLangcode('it')]);
$this->assertContextualLinkPlaceHolder($id);
// Authenticated user: can access contextual links, cannot edit articles.
$this->drupalLogin($this->authenticatedUser);
$this->drupalGet('node');
@ -126,19 +127,13 @@ class ContextualDynamicContextTest extends WebTestBase {
$this->drupalLogin($this->anonymousUser);
$this->drupalGet('node');
for ($i = 0; $i < count($ids); $i++) {
$this->assertContextualLinkPlaceHolder($ids[$i]);
$this->assertNoContextualLinkPlaceHolder($ids[$i]);
}
$this->renderContextualLinks(array(), 'node');
$this->assertResponse(403);
$this->renderContextualLinks($ids, 'node');
$this->assertResponse(403);
// Verify that link language is properly handled.
$node3->addTranslation('it')->set('title', $this->randomString())->save();
$id = 'node:node=' . $node3->id() . ':changed=' . $node3->getChangedTime() . '&langcode=it';
$this->drupalGet('node', ['language' => ConfigurableLanguage::createFromLangcode('it')]);
$this->assertContextualLinkPlaceHolder($id);
// Get a page where contextual links are directly rendered.
$this->drupalGet(Url::fromRoute('menu_test.contextual_test'));
$this->assertEscaped("<script>alert('Welcome to the jungle!')</script>");

View file

@ -1,13 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Tests\ContextualUnitTest.
*/
namespace Drupal\Tests\contextual\Kernel;
namespace Drupal\contextual\Tests;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests all edge cases of converting from #contextual_links to ids and vice