commit b258ec4ad4d74216de4ae9e6fdb3b09895e08bfa Author: Joel Pittet Date: Sun Dec 8 17:18:00 2013 -0800 merging diff --git a/core/includes/common.inc b/core/includes/common.inc index 12ccffd..dccf647 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3428,6 +3428,13 @@ function drupal_pre_render_link($element) { $element['#options']['attributes'] += $element['#attributes']; } + // Merge the provided attributes on top of the default attributes + // provided by the element definition. + if (isset($element['#default_attributes'])) { + $element['#options'] += array('attributes' => array()); + $element['#options']['attributes'] = NestedArray::mergeDeep($element['#default_attributes'], $element['#options']['attributes']); + } + // This #pre_render callback can be invoked from inside or outside of a Form // API context, and depending on that, a HTML ID may be already set in // different locations. #options should have precedence over Form API's #id. diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php index b051447..d6bfa7d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php @@ -138,7 +138,7 @@ function testMoreLink() { 'class' => array('drupal', 'test'), ), ), - 'expected' => 'More', + 'expected' => 'More', ), ); $this->assertElements($elements); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 3f02c56..e1aaca7 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -539,7 +539,7 @@ function system_element_info() { // A "more" link, like those used in blocks. $types['more_link'] = $types['link'] + array( '#title' => t('More'), - '#attributes' => array('class' => 'more-link'), + '#default_attributes' => array('class' => array('more-link')), ); $types['fieldset'] = array( '#value' => NULL,