Commit 87fe2f4c authored by webchick's avatar webchick

Issue #2231505 by joelpittet, baisong | Cottser: Convert theme_field__node__title() to Twig.

parent 24605077
...@@ -139,9 +139,9 @@ function testPathLanguageConfiguration() { ...@@ -139,9 +139,9 @@ function testPathLanguageConfiguration() {
// Test that both node titles link to our path alias. // Test that both node titles link to our path alias.
$this->drupalGet('<front>'); $this->drupalGet('<front>');
$custom_path_url = base_path() . $GLOBALS['script_path'] . $custom_path; $custom_path_url = base_path() . $GLOBALS['script_path'] . $custom_path;
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $first_node->label())); $elements = $this->xpath('//a[@href=:href]/span[normalize-space(text())=:title]', array(':href' => $custom_path_url, ':title' => $first_node->label()));
$this->assertTrue(!empty($elements), 'First node links to the path alias.'); $this->assertTrue(!empty($elements), 'First node links to the path alias.');
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $second_node->label())); $elements = $this->xpath('//a[@href=:href]/span[normalize-space(text())=:title]', array(':href' => $custom_path_url, ':title' => $second_node->label()));
$this->assertTrue(!empty($elements), 'Second node links to the path alias.'); $this->assertTrue(!empty($elements), 'Second node links to the path alias.');
// Confirm that the custom path leads to the first node. // Confirm that the custom path leads to the first node.
......
...@@ -175,6 +175,7 @@ function node_theme() { ...@@ -175,6 +175,7 @@ function node_theme() {
), ),
'field__node__title' => array( 'field__node__title' => array(
'base hook' => 'field', 'base hook' => 'field',
'template' => 'field--node--title',
), ),
); );
} }
...@@ -705,23 +706,6 @@ function template_preprocess_node(&$variables) { ...@@ -705,23 +706,6 @@ function template_preprocess_node(&$variables) {
$variables['content_attributes']['class'][] = 'content'; $variables['content_attributes']['class'][] = 'content';
} }
/**
* Returns HTML for the node title field.
*
* This is an override of theme_field() for the node title field. See that
* function for documentation about its details and overrides.
*
* @param array $variables
* An associative array. See theme_field() for details.
*
* @see theme_field()
*
* @ingroup themeable
*/
function theme_field__node__title($variables) {
return '<span' . $variables['attributes'] . '>' . drupal_render($variables['items']) . '</span>';
}
/** /**
* Implements hook_permission(). * Implements hook_permission().
*/ */
......
{#
/**
* @file
* Default theme implementation for the node title field.
*
* This is an override of field.html.twig for the node title field. See that
* template for documentation about its details and overrides.
*
* Available variables:
* - attributes: HTML attributes for the containing span element.
* - items: List of all the field items.
*
* @see field.html.twig
*
* @ingroup themeable
*/
#}
<span{{ attributes }}>{{ items }}</span>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment