summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-15 12:27:34 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-15 12:27:34 +0000
commit35e21e54e1122f98bede28f89d80f2fb13b3fd97 (patch)
treeb757a831278a4dbc99a3ae5042cc37f95f53aacb /modules
parent5acbec27001aa382699cf144d9a953c9b725bc01 (diff)
downloadbrdo-35e21e54e1122f98bede28f89d80f2fb13b3fd97.tar.gz
brdo-35e21e54e1122f98bede28f89d80f2fb13b3fd97.tar.bz2
- Patch #412730 by Crell, jbomb, JohnAlbin: theme system should report when a theme key is not found.
Diffstat (limited to 'modules')
-rw-r--r--modules/forum/forum.admin.inc15
-rw-r--r--modules/forum/forum.module4
-rw-r--r--modules/simpletest/tests/theme.test19
-rw-r--r--modules/system/system.admin.inc15
-rw-r--r--modules/system/system.module25
5 files changed, 75 insertions, 3 deletions
diff --git a/modules/forum/forum.admin.inc b/modules/forum/forum.admin.inc
index d7dbe5fa3..105e2fd26 100644
--- a/modules/forum/forum.admin.inc
+++ b/modules/forum/forum.admin.inc
@@ -99,6 +99,21 @@ function forum_form_submit($form, &$form_state) {
}
/**
+ * Theme forum forms.
+ *
+ * By default this does not alter the appearance of a form at all,
+ * but is provided as a convenience for themers.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ * @ingroup themeable
+ */
+function theme_forum_form($variables) {
+ return drupal_render_children($variables['form']);
+}
+
+/**
* Returns a form for adding a container to the forum vocabulary
*
* @param $edit Associative array containing a container term to be added or edited.
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 95c0337e6..6a62bdfe8 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -57,6 +57,10 @@ function forum_theme() {
'template' => 'forum-submitted',
'arguments' => array('topic' => NULL),
),
+ 'forum_form' => array(
+ 'arguments' => array('form' => NULL),
+ 'file' => 'forum.admin.inc',
+ ),
);
}
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index 56860bd13..823a50c67 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -50,6 +50,23 @@ class TemplateUnitTest extends DrupalWebTestCase {
$suggestions = array("page\0");
$this->assertEqual(drupal_discover_template(array('themes/garland'), $suggestions), 'themes/garland/page.tpl.php', t('Unsafe template suggestion fixed'));
}
+
+ /**
+ * Test that not-found theme hook throw a proper exception.
+ */
+ function testThemeHookNotFound() {
+ try {
+ theme('this_does_not_exist');
+
+ $this->fail(t('Exception not thrown for invalid theme hook.'));
+ }
+ catch (ThemeHookNotFoundException $e) {
+ $this->assertEqual($e->getMessage(), t('Theme hook "this_does_not_exist" not found.'), t('Correct exception thrown with correct error message.'));
+ }
+ catch (Exception $e) {
+ $this->fail(t('Exception of type "@type" thrown instead of ThemeHookNotFoundException.', array('@type' => gettype($e))));
+ }
+ }
}
/**
@@ -63,7 +80,7 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
'group' => 'Theme',
);
}
-
+
/**
* Tableheader.js provides 'sticky' table headers, and is included by default.
*/
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 825249f70..3694848bf 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -2381,6 +2381,21 @@ function theme_system_modules_uninstall($variables) {
}
/**
+ * Theme function for the system settings form.
+ *
+ * By default this does not alter the appearance of a form at all,
+ * but is provided as a convenience for themers.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ * @ingroup themeable
+ */
+function theme_system_settings_form($variables) {
+ return drupal_render_children($variables['form']);
+}
+
+/**
* Theme function for the system themes form.
*
* @param $variables
diff --git a/modules/system/system.module b/modules/system/system.module
index a6278b485..98ceebc0f 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -159,6 +159,13 @@ function system_theme() {
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
),
+ 'system_settings_form' => array(
+ 'arguments' => array('form' => NULL),
+ 'file' => 'system.admin.inc',
+ ),
+ 'confirm_form' => array(
+ 'arguments' => array('form' => NULL),
+ ),
'system_modules_fieldset' => array(
'arguments' => array('form' => NULL),
'file' => 'system.admin.inc',
@@ -1746,7 +1753,7 @@ function system_admin_menu_block($item) {
$has_subitems = FALSE;
$result = db_query("
SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.theme_callback, m.theme_arguments, m.type, m.description, m.path, m.weight as router_weight, ml.*
- FROM {menu_router} m
+ FROM {menu_router} m
LEFT JOIN {menu_links} ml ON m.path = ml.router_path
WHERE (ml.plid = :plid AND ml.menu_name = :name AND hidden = 0) OR (m.tab_parent = :path AND m.type IN (:local_task, :default_task))", array(':plid' => $item['mlid'], ':name' => $item['menu_name'], ':path' => $item['path'], ':local_task' => MENU_LOCAL_TASK, ':default_task' => MENU_DEFAULT_LOCAL_TASK), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $link) {
@@ -1780,7 +1787,7 @@ function system_admin_menu_block($item) {
}
}
if ($has_subitems) {
- // If we've had at least one non-tab subitem, remove the link for the
+ // If we've had at least one non-tab subitem, remove the link for the
// default task, since that is already broken down to subitems.
unset($content[$default_task]);
}
@@ -3364,3 +3371,17 @@ function system_date_format_delete($dfid) {
->execute();
}
+/**
+ * Theme confirmation forms.
+ *
+ * By default this does not alter the appearance of a form at all,
+ * but is provided as a convenience for themers.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ * @ingroup themeable
+ */
+function theme_confirm_form($variables) {
+ return drupal_render_children($variables['form']);
+}