Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078

This commit is contained in:
Pantheon Automation 2015-11-04 11:11:27 -08:00 committed by Greg Anderson
parent 6419a031d7
commit 4afb23bbd3
762 changed files with 20080 additions and 6368 deletions

View file

@ -7,6 +7,7 @@
namespace Drupal\toolbar\Controller;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Controller\ControllerBase;
@ -52,7 +53,8 @@ class ToolbarController extends ControllerBase {
* The access result.
*/
public function checkSubTreeAccess($hash) {
return AccessResult::allowedIf($this->currentUser()->hasPermission('access toolbar') && $hash == _toolbar_get_subtrees_hash()[0])->cachePerPermissions();
$expected_hash = _toolbar_get_subtrees_hash()[0];
return AccessResult::allowedIf($this->currentUser()->hasPermission('access toolbar') && Crypt::hashEquals($expected_hash, $hash))->cachePerPermissions();
}
}

View file

@ -97,9 +97,6 @@ class Toolbar extends RenderElement {
$element[$key]['#id'] = Html::getId('toolbar-item-' . $key);
}
// Render the children.
$element['#children'] = drupal_render_children($element);
return $element;
}

View file

@ -215,7 +215,6 @@ class ToolbarAdminMenuTest extends WebTestBase {
*/
function testNonCurrentUserAccountUpdates() {
$admin_user_id = $this->adminUser->id();
$admin_user_2_id = $this->adminUser2->id();
$this->hash = $this->getSubtreesHash();
// adminUser2 will add a role to adminUser.
@ -258,12 +257,8 @@ class ToolbarAdminMenuTest extends WebTestBase {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomMachineName(16);
// This is the language indicator on the translation search screen for
// untranslated strings.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
// This will be the translation of $name.
$translation = $this->randomMachineName(16);
$translation_to_en = $this->randomMachineName(16);
// Add custom language.
$this->drupalLogin($admin_user);

View file

@ -87,11 +87,20 @@ function template_preprocess_toolbar(&$variables) {
$variables['tabs'] = array();
$variables['remainder'] = array();
foreach (Element::children($element) as $key) {
// Early rendering to collect the wrapper attributes from
// ToolbarItem elements.
if (!empty($element[$key])) {
Drupal::service('renderer')->render($element[$key]);
}
// Add the tray.
if (isset($element[$key]['tray'])) {
$attributes = array();
if (!empty($element[$key]['tray']['#wrapper_attributes'])) {
$attributes = $element[$key]['tray']['#wrapper_attributes'];
}
$variables['trays'][$key] = array(
'links' => $element[$key]['tray'],
'attributes' => new Attribute($element[$key]['tray']['#wrapper_attributes']),
'attributes' => new Attribute($attributes),
);
if (array_key_exists('#heading', $element[$key]['tray'])) {
$variables['trays'][$key]['label'] = $element[$key]['tray']['#heading'];
@ -102,7 +111,7 @@ function template_preprocess_toolbar(&$variables) {
if (isset($element[$key]['tab'])) {
$attributes = array();
// Pass the wrapper attributes along.
if (array_key_exists('#wrapper_attributes', $element[$key])) {
if (!empty($element[$key]['#wrapper_attributes'])) {
$attributes = $element[$key]['#wrapper_attributes'];
}