Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ctools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
ctools
Commits
ddb44977
Commit
ddb44977
authored
16 years ago
by
Earl Miles
Browse files
Options
Downloads
Patches
Plain Diff
#371433 by Amitaibu: Improve dependent.inc documentation.
parent
09d94d4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/dependent.inc
+39
-0
39 additions, 0 deletions
includes/dependent.inc
with
39 additions
and
0 deletions
includes/dependent.inc
+
39
−
0
View file @
ddb44977
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
* field that is used to determine where in $form_state['values'] you will find
* field that is used to determine where in $form_state['values'] you will find
* the value of the form.
* the value of the form.
*
*
* The item that is dependent on, should be set to #tree = TRUE.
*
* Usage:
* Usage:
*
*
* First, ensure this tool is loaded:
* First, ensure this tool is loaded:
...
@@ -40,6 +42,43 @@
...
@@ -40,6 +42,43 @@
* On any form item, add
* On any form item, add
* - @code '#process' => array('ctools_dependent_process'), @endcode
* - @code '#process' => array('ctools_dependent_process'), @endcode
* - @code '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)), @endcode
* - @code '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)), @endcode
*
* A fuller example, that hides the menu title when no menu is selected:
* @code
*function ctools_dependent_example() {
* $form = array();
* $form['menu'] = array(
* '#type' => 'fieldset',
* '#title' => t('Menu settings'),
* '#tree' => TRUE,
* );
* $form['menu']['type'] = array(
* '#title' => t('Menu type'),
* '#type' => 'radios',
* '#options' => array(
* 'none' => t('No menu entry'),
* 'normal' => t('Normal menu entry'),
* 'tab' => t('Menu tab'),
* 'default tab' => t('Default menu tab'),
* ),
* '#default_value' => 'none',
* );
*
* $form['menu']['title'] = array(
* '#title' => t('Title'),
* '#type' => 'textfield',
* '#default_value' => '',
* '#description' => t('If set to normal or tab, enter the text to use for the menu item.'),
* '#process' => array('ctools_dependent_process'),
* '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')),
* );
*
* $form['menu']['title']['#process'] = array('ctools_dependent_process');
* $form['menu']['title']['#dependency'] = array('radio:menu[type]' => array('normal', 'tab', 'default tab'));
*
* return system_settings_form($form);
*}
* @endcode
*/
*/
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment