summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2013-07-13 11:09:13 (GMT)
committer Nathaniel Catchpole2013-07-13 11:09:13 (GMT)
commite8919c6d42f67955a35dd67dd616556972baa54d (patch)
treeb86cfaef9ebbdc37a5af8663403427ad38495a8d
parent7232dbf9f1d031a56034e09b58bbacd6864439c9 (diff)
Issue #2009680 by DarthDrupal, cwells73, Samvel, adamcowboy, hussainweb: Fixed Replace theme() with drupal_render() in taxonomy module.
-rw-r--r--core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php60
-rw-r--r--core/modules/taxonomy/taxonomy.admin.inc9
2 files changed, 68 insertions, 1 deletions
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php
new file mode 100644
index 0000000..59970c4
--- /dev/null
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\taxonomy\Tests\TaxonomyTermIndentationTest.
+ */
+
+namespace Drupal\taxonomy\Tests;
+
+/**
+ * Testing term indentation functionality in term list page.
+ */
+class TaxonomyTermIndentationTest extends TaxonomyTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = array('taxonomy');
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Taxonomy term indentation',
+ 'description' => 'Ensure that the term indentation works properly.',
+ 'group' => 'Taxonomy',
+ );
+ }
+
+ public function setUp() {
+ parent::setUp();
+ $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'bypass node access'));
+ $this->drupalLogin($this->admin_user);
+ $this->vocabulary = $this->createVocabulary();
+ }
+
+ /**
+ * Tests term indentation.
+ */
+ function testTermIndentation() {
+ // Create three taxonomy terms.
+ $term1 = $this->createTerm($this->vocabulary);
+ $term2 = $this->createTerm($this->vocabulary);
+ $term3 = $this->createTerm($this->vocabulary);
+
+ // Indent the second term under the first one.
+ $edit = array(
+ 'terms[tid:' . $term2->id() . ':0][term][tid]' => 2,
+ 'terms[tid:' . $term2->id() . ':0][term][parent]' => 1,
+ 'terms[tid:' . $term2->id() . ':0][term][depth]' => 1,
+ 'terms[tid:' . $term2->id() . ':0][weight]' => 1,
+ );
+
+ // Submit the edited form and check for HTML indentation element presence.
+ $this->drupalPost('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid'), $edit, t('Save'));
+ $this->assertPattern('|<div class="indentation">&nbsp;</div>|');
+ }
+
+}
+
diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc
index 62defe2..4161f5a 100644
--- a/core/modules/taxonomy/taxonomy.admin.inc
+++ b/core/modules/taxonomy/taxonomy.admin.inc
@@ -159,8 +159,15 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) {
);
foreach ($current_page as $key => $term) {
$form['terms'][$key]['#term'] = $term;
+ $indentation = array();
+ if (isset($term->depth) && $term->depth > 0) {
+ $indentation = array(
+ '#theme' => 'indentation',
+ '#size' => $term->depth,
+ );
+ }
$form['terms'][$key]['term'] = array(
- '#prefix' => isset($term->depth->value) && $term->depth->value > 0 ? theme('indentation', array('size' => $term->depth->value)) : '',
+ '#prefix' => !empty($indentation) ? drupal_render($indentation) : '',
'#type' => 'link',
'#title' => $term->label(),
'#href' => "taxonomy/term/" . $term->id(),