summaryrefslogtreecommitdiff
path: root/modules/field_ui
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-26 14:40:47 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-26 14:40:47 +0000
commit90f598d522dd4b5eac0da1ea9f8f9f58b6bb31ef (patch)
tree070a7f6f3c8be93708d18ad1889032437114a5f1 /modules/field_ui
parentbdffe48163b243a99618de4d4e40027642c5fcbf (diff)
downloadbrdo-90f598d522dd4b5eac0da1ea9f8f9f58b6bb31ef.tar.gz
brdo-90f598d522dd4b5eac0da1ea9f8f9f58b6bb31ef.tar.bz2
- Patch #777102 by jhodgdon: hook_field_ui_view_modes_tabs() is undocumented.
Diffstat (limited to 'modules/field_ui')
-rw-r--r--modules/field_ui/field_ui.api.php37
-rw-r--r--modules/field_ui/field_ui.module40
2 files changed, 59 insertions, 18 deletions
diff --git a/modules/field_ui/field_ui.api.php b/modules/field_ui/field_ui.api.php
index 1582da43a..2e5cc9f3d 100644
--- a/modules/field_ui/field_ui.api.php
+++ b/modules/field_ui/field_ui.api.php
@@ -143,5 +143,42 @@ function hook_field_formatter_settings_form($formatter, $settings, $field, $inst
}
/**
+ * Provide information on view mode tabs for an entity type.
+ *
+ * @param $entity_type
+ * The type of entity to return tabs for.
+ *
+ * @return
+ * An array whose keys are internal-use tab names, and whose values are
+ * arrays of tab information, with the following elements:
+ * - 'title': Human-readable title of the tab.
+ * - 'view modes': Array of view modes for this entity type that should
+ * be displayed on this tab.
+ *
+ * @see field_ui_view_modes_tabs()
+ */
+function hook_field_ui_view_modes_tabs($entity_type) {
+ $modes = array(
+ 'basic' => array(
+ 'title' => t('Basic'),
+ 'view modes' => array('teaser', 'full'),
+ ),
+ 'rss' => array(
+ 'title' => t('RSS'),
+ 'view modes' => array('rss'),
+ ),
+ 'print' => array(
+ 'title' => t('Print'),
+ 'view modes' => array('print'),
+ ),
+ 'search' => array(
+ 'title' => t('Search'),
+ 'view modes' => array('search_index', 'search_result'),
+ ),
+ );
+ return $modes;
+}
+
+/**
* @} End of "ingroup field_ui_field_type"
*/
diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module
index 5680c0fd2..3bb5cd886 100644
--- a/modules/field_ui/field_ui.module
+++ b/modules/field_ui/field_ui.module
@@ -237,7 +237,28 @@ function field_ui_theme() {
}
/**
- * Group available view modes on tabs on the 'Manage display' page.
+ * Returns information about tab groups for view modes on an entity type.
+ *
+ * On the 'Manage display' page, an administrator can manage the display of
+ * fields for each view mode for an entity type. The view modes are organized
+ * into tabs. This function returns the list of entity types to display on
+ * each tab, as well as the titles of the tabs.
+ *
+ * @param $entity_type
+ * The type of entity to return tab information for.
+ * @param $tab_selector
+ * If not NULL, return only information for this particular tab; if NULL,
+ * return all tab information.
+ *
+ * @return
+ * Array of information about the tabs to display. The keys are internal-use
+ * tab names and the values are arrays of tab information, with the following
+ * elements:
+ * - 'title': Human-readable title of the tab.
+ * - 'view modes': Array of view modes for this entity type that should
+ * be displayed on this tab.
+ *
+ * @see hook_field_ui_view_modes_tabs()
*
* @todo Remove this completely and use vertical tabs?
*/
@@ -271,23 +292,6 @@ function field_ui_view_modes_tabs($entity_type, $tab_selector = NULL) {
/**
* Implements hook_field_ui_view_modes_tabs() on behalf of other core modules.
- *
- * @return
- * An array describing the view modes defined by the module, grouped by tabs.
- *
- * A module can add its render modes to a tab defined by another module.
- * Expected format:
- * @code
- * array(
- * 'tab1' => array(
- * 'title' => t('The human-readable title of the tab'),
- * 'view modes' => array('mymodule_mode1', 'mymodule_mode2'),
- * ),
- * 'tab2' => array(
- * // ...
- * ),
- * );
- * @endcode
*/
function field_ui_field_ui_view_modes_tabs() {
$modes = array(