summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-20 09:31:08 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-20 09:31:08 +0000
commit3c9dfeb8420f3c1f4e35902878e9cc5795ce9732 (patch)
treecda05afcbef20031ef6f67851b942b8e4f7b5bc6
parentf617f0e30a27bce03bf1ae4a527e21faa96bd2e3 (diff)
downloadbrdo-3c9dfeb8420f3c1f4e35902878e9cc5795ce9732.tar.gz
brdo-3c9dfeb8420f3c1f4e35902878e9cc5795ce9732.tar.bz2
#678592 by jhodgdon, effulgentsia, David Rothstein, iLLin: Fixed Admin theme is used is for adding taxonomy term, but not for editing taxonomy term
-rw-r--r--modules/taxonomy/taxonomy.module12
-rw-r--r--modules/taxonomy/taxonomy.test47
2 files changed, 59 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 5097da288..edfa7d42f 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -299,6 +299,8 @@ function taxonomy_menu() {
'page arguments' => array('taxonomy_form_term', 2),
'access callback' => 'taxonomy_term_edit_access',
'access arguments' => array(2),
+ 'theme callback' => 'variable_get',
+ 'theme arguments' => array('admin_theme'),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
'file' => 'taxonomy.admin.inc',
@@ -357,6 +359,16 @@ function taxonomy_menu() {
}
/**
+ * Implements hook_admin_paths().
+ */
+function taxonomy_admin_paths() {
+ $paths = array(
+ 'taxonomy/term/*/edit' => TRUE,
+ );
+ return $paths;
+}
+
+/**
* Return edit access for a given term.
*/
function taxonomy_term_edit_access($term) {
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 0a08c1bde..7d5533b77 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -1131,3 +1131,50 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
}
}
}
+
+/**
+ * Tests for verifying that taxonomy pages use the correct theme.
+ */
+class TaxonomyThemeTestCase extends TaxonomyWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Taxonomy theme switching',
+ 'description' => 'Verifies that various taxonomy pages use the expected theme.',
+ 'group' => 'Taxonomy',
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ // Make sure we are using distinct default and administrative themes for
+ // the duration of these tests.
+ variable_set('theme_default', 'bartik');
+ variable_set('admin_theme', 'seven');
+
+ // Create and log in as a user who has permission to add and edit taxonomy
+ // terms.
+ $admin_user = $this->drupalCreateUser(array('administer taxonomy'));
+ $this->drupalLogin($admin_user);
+ }
+
+ /**
+ * Test the theme used when adding, viewing and editing taxonomy terms.
+ */
+ function testTaxonomyTermThemes() {
+ // Adding a term to a vocabulary is considered an administrative action and
+ // should use the administrative theme.
+ $vocabulary = $this->createVocabulary();
+ $this->drupalGet('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add');
+ $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page for adding a taxonomy term."));
+
+ // Viewing a taxonomy term should use the default theme.
+ $term = $this->createTerm($vocabulary);
+ $this->drupalGet('taxonomy/term/' . $term->tid);
+ $this->assertRaw('bartik/css/style.css', t("The default theme's CSS appears on the page for viewing a taxonomy term."));
+
+ // Editing a taxonomy term should use the same theme as adding one.
+ $this->drupalGet('taxonomy/term/' . $term->tid . '/edit');
+ $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page for editing a taxonomy term."));
+ }
+}