function fancybox_admin_settings_form in fancyBox 7
Same name and namespace in other branches
- 6 fancybox.admin.inc \fancybox_admin_settings_form()
- 7.2 fancybox.admin.inc \fancybox_admin_settings_form()
Display the Fancybox settings form.
1 string reference to 'fancybox_admin_settings_form'
- fancybox_menu in ./
fancybox.module - Implementation of hook_menu().
File
- ./
fancybox.admin.inc, line 11 - Administration page callbacks for the Fancybox module.
Code
function fancybox_admin_settings_form($form_state) {
$form = array();
if ($files = variable_get('fancybox_files', NULL)) {
// Check if detected files changed
$detected_files = _detect_fancybox_files();
if ($files['js'] != $detected_files['js'] || $files['css'] != $detected_files['css']) {
_set_fancybox_files();
}
$form['fancybox_files'] = array(
'#prefix' => '<div class="messages status">',
'#suffix' => '</div>',
'#markup' => t('Plugin detected, using @js_file and @css_file', array(
'@js_file' => $detected_files['js'],
'@css_file' => $detected_files['css'],
)),
);
}
else {
_set_fancybox_files();
}
$settings = variable_get('fancybox_settings', array());
$data = array();
// Options:
$data['options'] = array(
'#type' => 'fieldset',
'#title' => t('Options'),
'#tree' => TRUE,
);
$data['options'] += fancybox_options(!empty($settings['options']) ? $settings['options'] : array());
// Activation:
$data['activation'] = array(
'#type' => 'fieldset',
'#title' => t('Activation'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$data['activation']['selector'] = array(
'#type' => 'textarea',
'#title' => t('jQuery selector'),
'#default_value' => isset($settings['activation']['selector']) ? $settings['activation']['selector'] : '',
);
$data['activation']['activation_type'] = array(
'#type' => 'radios',
'#title' => t('Enable Fancybox on specific pages'),
'#options' => array(
'exclude' => t('Enable on every page except the listed pages.'),
'include' => t('Enable on only the listed pages.'),
),
'#default_value' => isset($settings['activation']['activation_type']) ? $settings['activation']['activation_type'] : 'exclude',
);
if (user_access('use PHP for block visibility')) {
$data['activation']['activation_type']['#options']['php'] = t('Enable if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
}
$data['activation']['activation_pages'] = array(
'#type' => 'textarea',
'#title' => t('Pages'),
'#default_value' => isset($settings['activation']['activation_pages']) ? $settings['activation']['activation_pages'] : "admin*\nimg_assist*\nnode/add/*\nnode/*/edit",
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
);
// ImageField module:
if (module_exists('image')) {
$data['imagefield'] = array(
'#type' => 'fieldset',
'#title' => t('ImageField module'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$data['imagefield']['grouping'] = array(
'#type' => 'radios',
'#title' => t('Grouping'),
'#options' => array(
1 => t('Group per field'),
2 => t('Group all fields on page'),
0 => t('No grouping'),
),
'#default_value' => isset($settings['imagefield']['grouping']) ? $settings['imagefield']['grouping'] : 1,
);
}
$data['imagefield']['use_node_title'] = array(
'#type' => 'checkbox',
'#title' => t('Use node title as caption'),
'#description' => t('By default, the caption for image fields is the title text for the image. If no title is configured, the alt text will be used. Check this to always display the node title as the image caption.'),
'#default_value' => isset($settings['imagefield']['use_node_title']) ? $settings['imagefield']['use_node_title'] : FALSE,
);
$form['data'] = $data;
$form['data']['#tree'] = TRUE;
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['buttons']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset to defaults'),
);
return $form;
}