function ddblock_form_alter in Dynamic display block 7
Same name and namespace in other branches
- 6 ddblock.module \ddblock_form_alter()
Implements hook_form_alter().
Used to add dynamic display block configuration settings to dynamic display block instances.
File
- ./
ddblock.module, line 840 - Enables your site to display dynamic content in a block.
Code
function ddblock_form_alter(&$form, &$form_state, $form_id) {
$module = arg(4);
$delta = arg(5);
if (isset($delta) && $module == 'ddblock' && user_access('administer dynamic display blocks') && user_access('administer blocks') && $form_id == 'block_admin_configure') {
// get original block_settings.
$block = ddblock_get_blocks($delta);
$module_original = $block->module;
$delta_original = $block->delta_original;
// check if module enabled in the dynamic display block settings.
$block_enabled = FALSE;
$blocks = ddblock_get_ddblock_enabled_module_blocks();
foreach ($blocks as $block) {
if ($block['module'] == $module_original && $block['delta'] == $delta_original) {
$block_enabled = TRUE;
}
}
if ($block_enabled) {
if ($module_original == 'views') {
// block.module has a delta length limit of 32, but deltas in the views module can
// be longer because view names can be 32 and display IDs can also be 32.
// So for very long deltas, md5 hashes are used.
if (strlen($delta_original) == 32) {
$hashes = variable_get('views_block_hashes', array());
if (!empty($hashes[$delta_original])) {
$delta_original = $hashes[$delta_original];
}
}
list($view_name, $display_id) = explode('-', $delta_original);
// Load the view
if ($view = views_get_view($view_name)) {
if ($view
->access($display_id)) {
// get the possible source fields form the view
$source_fields = array(
'none' => t('--None--'),
);
$display = $view->display[$display_id];
foreach ($display->handler
->get_handlers('field') as $field => $handler) {
$format = isset($handler->options['format']) ? ' - ' . $handler->options['format'] : '';
if ($label = $handler
->label()) {
$source_fields[$field] = $label . $format;
}
else {
$source_fields[$field] = $handler
->ui_name() . $format;
}
}
}
}
}
// get module path to dynamic display block module
$ddblock_path = drupal_get_path('module', 'ddblock');
// add ddblock js file
drupal_add_js($ddblock_path . '/js/ddblock.admin.js');
drupal_add_js($ddblock_path . '/js/jquery.selectboxes.js');
// get configuration settings
foreach (ddblock_get_configuration_settings('ddblock', $delta)
->settings() as $key => $value) {
${$key} = $value;
}
// get cycle configuration settings
foreach (ddblock_get_cycle_configuration_settings('ddblock_cycle', $delta)
->settings() as $key => $value) {
${$key} = $value;
}
// get cycle mapping settings
foreach (ddblock_get_cycle_mapping_settings('ddblock_cycle', $delta)
->settings() as $key => $value) {
${$key} = $value;
$mappings[$key]['target'] = $value['target'];
$mappings[$key]['source'] = $value['source'];
}
// set pager variable for javascript
$settings['ddblockCustomTemplate'] = array(
'pager' => $pager,
'pagerPosition' => $pager_position,
);
drupal_add_js($settings, array(
'type' => 'setting',
'scope' => JS_DEFAULT,
));
// hide fields when using advanced settings
$extra = !empty($advanced) ? ' style="display:none"' : '';
// show warning that cycle plugin is not installed.
$cycle_path = libraries_get_path('jquery.cycle');
if (empty($cycle_path) || !(file_exists($cycle_path . '/jquery.cycle.all.min.js') || file_exists($cycle_path . '/jquery.cycle.all.js'))) {
$form['no_cycle_js'] = array(
'#type' => 'item',
'#title' => 'Cycle plugin',
'#markup' => '<div style="color: red">' . t('You need to install the jQuery cycle plugin.<br />
Create a directory in sites/all/libraries called jquery.cycle, and then copy jquery.cycle.all.js or jquery.cycle.all.min.js into it.<br />
Latest version tested: 2.99<br />
You can find the plugin at !url.', array(
'!url' => l('http://malsup.com/jquery/cycle/download.html', 'http://malsup.com/jquery/cycle/download.html', array(
'attributes' => array(
'target' => '_blank',
),
)),
)) . '</div>',
'#prefix' => '<div id="ddblock-no-cycle-js">',
'#suffix' => '</div>',
'#weight' => -16,
);
}
$form['module'] = array(
'#type' => 'hidden',
'#value' => $module,
);
$form['delta'] = array(
'#type' => 'value',
'#value' => $delta,
);
$form['input_type'] = array(
'#type' => 'hidden',
'#value' => 'instance',
);
$form['#attached']['css'] = array(
drupal_get_path('module', 'ddblock') . '/css/ddblock_instance_admin.css',
);
// widget setting: Enable the dynamic display block setting for this block.
$options = array(
'default' => t('Default'),
'cycle' => t('Cycleblock'),
);
//wrapper for ddblock instance settings
$form['block_settings']['#prefix'] = '<div id="ddblock-instance-settings">';
$form['block_settings']['#suffix'] = '</div>';
$form['block_settings']['widget'] = array(
'#type' => 'radios',
'#title' => t('Display Method'),
'#default_value' => $widget,
'#options' => $options,
'#required' => TRUE,
'#description' => t("Choose a way to display content."),
'#weight' => -12,
);
// advanced settings togg;e
$form['block_settings']['advanced'] = array(
'#type' => 'checkbox',
'#title' => t('Use advanced settings'),
'#default_value' => $advanced,
'#required' => FALSE,
'#description' => t("Use Custom templates and CSS (more flexible)"),
'#weight' => -11,
);
// select themes from [Theme_name]/custom/modules/ddblock
$path_to_themes = _ddblock_get_theme_path() . '/custom/modules/ddblock';
$dirs = _ddblock_dir_scan_directory($path_to_themes, '');
$options = array();
if (!empty($dirs)) {
asort($dirs);
foreach ($dirs as $dir) {
$options[$dir] = $dir;
}
}
$form['block_settings']['template'] = array(
'#type' => 'select',
'#title' => t('Slideshow theme layout'),
'#default_value' => $template,
'#options' => $options,
'#multiple' => FALSE,
'#required' => FALSE,
'#prefix' => '<div id="ddblock-template-wrapper">',
'#suffix' => '</div>',
'#description' => t("Available slideshow themes are automatically detected form the folder custom/modules/ddblock.<br />\n A slideshow themes can only contain letters and numbers, no underscores and hyphens, etc.<br />\n The .tpl.php file used will become:ddblock-cycle-block-content--[THEMENAME].tpl.php"),
'#weight' => -10,
);
if (isset($form_state['values'])) {
$form_state_values = $form_state['values'];
}
$template = isset($form_state_values['block_settings']['template']) ? $form_state_values['block_settings']['template'] : $template;
$template_sizes = _ddblock_get_template_size($template);
// Since a #select element can't have it's own #submit handler, we have to create an extra
// submit button to which we attach the correct callback function that's going to be called on a change
// We'll hide this with '#access' => FALSE.
$form['block_settings']['template_submit'] = array(
'#type' => 'submit',
'#value' => t('get template sizes'),
'#submit' => array(
'ddblock_options_form_submit',
),
'#weight' => -8,
// '#access'=> FALSE, // hide the button
'#description' => t('Get the possible themesizes after selecting a theme'),
);
// We define a <div> wrapper that contains the select box that needs to be refilled with data
$form['block_settings']['template_size_wrapper'] = array(
'#prefix' => '<div id="select-template-size-wrapper">',
'#suffix' => '</div>',
'#weight' => -9,
);
// This is the actual select that needs to be refreshed depending on what happens in the 'template' select
$form['block_settings']['template_size_wrapper']['template_size'] = array(
'#type' => 'select',
'#title' => t('Template size'),
'#options' => $template_sizes,
'#default_value' => $template_size,
'#description' => t('The slideshow template_size css file to use'),
// '#attributes' => array('class' => 'template-size-select'),
'#prefix' => '<div id="select-template-size">',
'#suffix' => '</div>',
);
// Wrapper in which to place both the mapped fields and the 'add mapping' form.
$form['block_settings']['mapping_wrapper'] = array(
'#weight' => -7,
'#prefix' => '<div class="clear-block" id="ddblock-mapping-wrapper">',
'#suffix' => '</div>',
);
$form['block_settings']['mapping_wrapper']['helptext'] = array(
'#type' => 'item',
'#title' => t('Field mappings'),
'#description' => t('In this part you map available fields to ddblock theme fields.<br />The ddblock theme fields are the target.<br />Source fields are fields available from your view.'),
);
$form['block_settings']['mapping_wrapper']['headingtable'] = array(
'#type' => 'item',
'#title' => t('Target
Source'),
);
// Wrapper to display existing mappingss.
$form['block_settings']['mapping_wrapper']['mappings'] = array(
'#prefix' => '<div id="ddblock-mappings">',
'#suffix' => '</div>',
);
// Get number of mappings.
$options = array();
$mapping_count = empty($mappings) ? 0 : count($mappings);
// Add the existing mappings to the form.
for ($delta = 0; $delta < $mapping_count; $delta++) {
$target = isset($mappings[$delta]['target']) ? $mappings[$delta]['target'] : '';
$source = isset($mappings[$delta]['source']) ? $mappings[$delta]['source'] : '';
// Display existing mappings using helper function ddblock_mapping_display_form().
$form['block_settings']['mapping_wrapper']['mappings'][$delta] = ddblock_mapping_display_form($delta, $target, $source, $source_fields);
}
if ($widget == 'default') {
$collapsed = TRUE;
}
else {
$collapsed = FALSE;
}
// content settings: what to use as content for the dynamic display block.
$form['block_settings']['settings'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#title' => t('Dynamic display block settings'),
'#weight' => 1,
);
// content container settings.
$form['block_settings']['content_container'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Content container settings'),
'#weight' => -3,
);
$form['block_settings']['content_container']['container_advanced'] = array(
'#type' => 'textfield',
'#title' => t('Content container'),
'#default_value' => $container_advanced,
'#required' => FALSE,
'#size' => 30,
'#description' => t("Container of the content to slide, eg. CSS selector img, to show images.<br />This can be any CSS selector containing a slide. e.g div.slide"),
);
$form['block_settings']['content_container']['overflow'] = array(
'#type' => 'checkbox',
'#title' => t('Overflow hidden'),
'#default_value' => $overflow,
'#prefix' => '<div id="ddblock-advanced-content-container-overflow-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Hide the overflow of the container"),
);
$form['block_settings']['content_container']['height'] = array(
'#type' => 'textfield',
'#title' => t('Container height'),
'#default_value' => $height,
'#prefix' => '<div id="ddblock-advanced-content-container-height-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Height of the content to show"),
);
$form['block_settings']['content_container']['width'] = array(
'#type' => 'textfield',
'#title' => t('Container width'),
'#default_value' => $width,
'#prefix' => '<div id="ddblock-advanced-content-container-width-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Width of the content to show"),
);
// Image settings.
$form['block_settings']['images'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Image settings'),
'#prefix' => '<div id="ddblock-image-settings-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#weight' => -3,
);
$form['block_settings']['images']['image_height'] = array(
'#type' => 'textfield',
'#title' => t('Image height'),
'#default_value' => $image_height,
'#required' => FALSE,
'#description' => t("Height of the image to show"),
);
$form['block_settings']['images']['image_width'] = array(
'#type' => 'textfield',
'#title' => t('Image width'),
'#default_value' => $image_width,
'#required' => FALSE,
'#description' => t("Width of the image to show"),
);
$options = _ddblock_get_effects();
$form['block_settings']['settings']['fx'] = array(
'#type' => 'select',
'#title' => t('Transition Effect'),
'#default_value' => $fx,
'#options' => $options,
'#multiple' => FALSE,
'#required' => TRUE,
'#description' => t("The transition effect between content.<br />(all for random effect per slide, none for no effect)<br />Multiple effects can be set in the Custom jQuery Cycle Plugin Settings."),
);
$options = _ddblock_get_easing_effects();
$form['block_settings']['settings']['easing_out'] = array(
'#type' => 'select',
'#title' => t('Transition Effect'),
'#default_value' => $easing_out,
'#options' => $options,
'#multiple' => FALSE,
'#required' => TRUE,
'#description' => t("The easing effect of the previous slide.<br />For easing effect examples, see: <a href=\"http://jqueryui.com/demos/effect/easing.html\" target=\"_blank\">easing demos</a>"),
);
$form['block_settings']['settings']['easing_in'] = array(
'#type' => 'select',
'#title' => t('Transition Effect'),
'#default_value' => $easing_in,
'#options' => $options,
'#multiple' => FALSE,
'#required' => TRUE,
'#description' => t("The easing effect of the next slide.<br />For easing effect examples, see: <a href=\"http://jqueryui.com/demos/effect/easing.html\" target=\"_blank\">easing demos</a>"),
);
$options = drupal_map_assoc(array(
0,
250,
500,
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
15000,
20000,
));
$form['block_settings']['settings']['speed'] = array(
'#type' => 'select',
'#title' => t('Speed'),
'#default_value' => $speed,
'#options' => $options,
'#required' => TRUE,
'#description' => t("Speed of the transitions (1000 = 1 second, 0 = direct)."),
);
$options = drupal_map_assoc(array(
0,
250,
500,
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
15000,
20000,
30000,
));
$form['block_settings']['settings']['timeout'] = array(
'#type' => 'select',
'#title' => t('Timeout'),
'#default_value' => $timeout,
'#options' => $options,
'#required' => TRUE,
'#description' => t("The time (in milliseconds) between transitions (1000 = 1 second, 0 to disable auto advance)."),
);
$options = array(
'none' => t('None'),
'asc' => t('Ascending'),
'desc' => t('Descending'),
'random' => t('Random'),
);
$form['block_settings']['settings']['order'] = array(
'#type' => 'select',
'#title' => t('Sort Order'),
'#default_value' => $order,
'#options' => $options,
'#multiple' => FALSE,
'#required' => TRUE,
'#description' => t("The display order of the content. None for using the original content order."),
);
$form['block_settings']['settings']['pause'] = array(
'#type' => 'checkbox',
'#title' => t('Pause'),
'#default_value' => $pause,
'#description' => t("Enable users to pause the cycle by hovering on the content of the slideshow."),
);
$form['block_settings']['settings']['next'] = array(
'#type' => 'checkbox',
'#title' => t('Next'),
'#default_value' => $next,
'#description' => t("Enable users to advanced to the next content by clicking on the content.<br />\n Note: When readmore button is used, don't enable this option."),
);
$form['block_settings']['settings']['pager2'] = array(
'#type' => 'checkbox',
'#title' => t('Prev/Next Pager'),
'#default_value' => $pager2,
'#required' => FALSE,
'#description' => t("Add a previous/next pager."),
);
// pager settings.
// show fields when using pager
$extra = empty($pager2) ? ' style="display:none"' : '';
$form['block_settings']['settings']['pager2_settings'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#prefix' => '<div id="ddblock-pager2-settings-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#title' => t('Prev/next pager settings'),
);
$options = array(
'click' => t('Click'),
'mouseover' => t('Mouseover'),
);
$form['block_settings']['settings']['pager2_settings']['pager2_event'] = array(
'#type' => 'select',
'#title' => t('Pager event'),
'#default_value' => $pager2_event,
'#options' => $options,
'#required' => FALSE,
'#description' => t("The event on which the prev/next pager reacts."),
);
$form['block_settings']['settings']['pager2_settings']['pager2_slide_prev'] = array(
'#type' => 'textfield',
'#title' => t('Prev text on slide'),
'#default_value' => $pager2_slide_prev,
'#size' => 30,
'#required' => FALSE,
'#description' => t("Caption for the prev pager on the slide.<br />Can also be empty if you use a background image to go to the previous slide."),
);
$form['block_settings']['settings']['pager2_settings']['pager2_slide_next'] = array(
'#type' => 'textfield',
'#title' => t('Next text on slide'),
'#default_value' => $pager2_slide_next,
'#size' => 30,
'#required' => FALSE,
'#description' => t("Caption for the next pager on the slide.<br />Can also be empty if you use a background image to go to the next slide."),
);
// hide prev/next pager when no prev/next slide available
$form['block_settings']['settings']['pager2_settings']['pager2_slide']['pager2_slide_hide'] = array(
'#type' => 'checkbox',
'#title' => t('Prev/Next Hide'),
'#default_value' => $pager2_slide_hide,
'#required' => FALSE,
'#description' => t("Hide Prev/Next Pager when no slide available."),
);
// pager settings togg;e
$form['block_settings']['settings']['pager_toggle'] = array(
'#type' => 'checkbox',
'#title' => t('Use Pager'),
'#default_value' => $pager_toggle,
'#required' => FALSE,
'#description' => t("Use a pager to select slides"),
);
// pager settings.
//show fields when using pager
$extra = empty($pager_toggle) ? ' style="display:none"' : '';
$form['block_settings']['settings']['pager_settings'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#prefix' => '<div id="ddblock-pager-settings-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#title' => t('Pager settings'),
);
$options = array(
'none' => t('None'),
'number-pager' => t('Number pager'),
'prev-next-pager' => t('Prev next pager'),
'custom-pager' => t('Custom pager'),
'scrollable-pager' => t('Scrollable pager'),
);
$form['block_settings']['settings']['pager_settings']['pager'] = array(
'#type' => 'select',
'#title' => t('Pager'),
'#default_value' => $pager,
'#options' => $options,
'#required' => TRUE,
'#description' => t("Type of pager to add."),
);
$form['block_settings']['settings']['pager_settings']['pager_height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => $pager_height,
'#prefix' => '<div id="ddblock-pager-height-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Height of the pager"),
);
$form['block_settings']['settings']['pager_settings']['pager_width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $pager_width,
'#prefix' => '<div id="ddblock-pager-width-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Width of the pager"),
);
$options = array(
'top' => t('Top'),
'right' => t('Right'),
'bottom' => t('Bottom'),
'left' => t('Left'),
);
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_position'] = array(
'#type' => 'select',
'#title' => t('Pager position'),
'#default_value' => $pager_position,
'#prefix' => '<div id="ddblock-pager-position-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#options' => $options,
'#required' => FALSE,
'#description' => t("Possible position for the pager.<br />The position must be supported by the template used to be effective."),
);
$options = array(
'click' => t('Click'),
'mouseover' => t('Mouseover'),
);
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_event'] = array(
'#type' => 'select',
'#title' => t('Pager event'),
'#default_value' => $pager_event,
'#prefix' => '<div id="ddblock-pager-event-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#options' => $options,
'#required' => FALSE,
'#description' => t("The event on which the pager reacts."),
);
// disable click if pager is mouseover
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_disable_click'] = array(
'#type' => 'checkbox',
'#title' => t('Disable Pager click'),
'#default_value' => $pager_disable_click,
'#prefix' => '<div id="ddblock-pager-disable-click-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Disable pager click when pager event is mouseover."),
);
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_fast'] = array(
'#type' => 'checkbox',
'#title' => t('Fast Pager'),
'#default_value' => $pager_fast,
'#prefix' => '<div id="ddblock-pager-fast-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("When pager is used to go to another slide, don't use the effect to go to the slide.<br />\n Use for quick selection of slides."),
);
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_pause'] = array(
'#type' => 'checkbox',
'#title' => t('Pager pause'),
'#default_value' => $pager_pause,
'#prefix' => '<div id="ddblock-pager-pause-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Pause the slideshow when the mouse is on the pager."),
);
// prev_next_pager_loop - Only show prev if previous slide exist - Only show next if next slide exist
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_prev_next_loop'] = array(
'#type' => 'checkbox',
'#title' => t('Prev/next Pager loop'),
'#default_value' => $pager_prev_next_loop,
'#prefix' => '<div id="ddblock-pager-prev-next-loop-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Loop the next/prev pager. If disabled:<br />- Only show prev if previous slide exist<br />- Only show next if next slide exist"),
);
// scrollable_pager_loop - Only show prev if previous slide exist - Only show next if next slide exist
//show fields when using advanced settings
$extra = empty($advanced) ? ' style="display:none"' : '';
// if the checkbox: Use advanced settings is not checked, hide the advanced settings
$form['block_settings']['settings']['pager_settings']['pager_scrollable_loop'] = array(
'#type' => 'checkbox',
'#title' => t('Scrollable Pager show navigation'),
'#default_value' => $pager_scrollable_loop,
'#prefix' => '<div id="ddblock-pager-scrollable-loop-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#required' => FALSE,
'#description' => t("Always show navigation items for scrollable pager. If disabled:<br />- Only show prev pager item when previous slide exist<br />- Only show next pager item when next slide exist"),
);
$form['block_settings']['settings']['pager_settings']['nr_of_pager_items'] = array(
'#type' => 'textfield',
'#title' => t('Nr of pager items'),
'#default_value' => $nr_of_pager_items,
'#prefix' => '<div id="ddblock-nr-of-pager-items-wrapper">',
'#suffix' => '</div>',
'#required' => FALSE,
'#size' => 30,
'#description' => t("For Custom pager: Number of items in a row.<br />For Scrollable pager: Set this to the number of pager items visible at one time in the scrollable pager.<br />This setting will rule the functionality of the scrollable pager."),
);
$form['block_settings']['settings']['pager_settings']['pager_container'] = array(
'#type' => 'textfield',
'#title' => t('Pager container'),
'#default_value' => $pager_container,
'#required' => FALSE,
'#size' => 30,
'#description' => t("Container of a pager-item, eg. CSS selector li.<br />This can be any CSS selector containing a pager-item. e.g .custom-pager-item<br />Most of the time this can be left at the default value."),
);
$form['block_settings']['settings']['slide_text'] = array(
'#type' => 'checkbox',
'#title' => t('Use slide text'),
'#default_value' => $slide_text,
'#required' => FALSE,
'#description' => t("Show slide text when available in content."),
);
// if the checkbox: Use jQuery effects for text of a slide is not checked, hide the slide text settings
$extra = empty($slide_text) ? ' style="display:none"' : '';
$form['block_settings']['settings']['slide_text_settings'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Slide text settings'),
'#prefix' => '<div id="ddblock-slide-text-settings-wrapper"' . $extra . '>',
'#suffix' => '</div>',
);
// slide text container field.
$form['block_settings']['settings']['slide_text_settings']['slide_text_container'] = array(
'#type' => 'textfield',
'#title' => t('Slide text container'),
'#default_value' => $slide_text_container,
'#required' => FALSE,
'#size' => 30,
'#description' => t("Container of the slide text. Most of the time, can be left at default"),
'#weight' => 5,
);
$options = array(
'top' => t('Top'),
'right' => t('Right'),
'bottom' => t('Bottom'),
'left' => t('Left'),
);
$form['block_settings']['settings']['slide_text_settings']['slide_text_position'] = array(
'#type' => 'select',
'#title' => t('Slide text position'),
'#default_value' => $slide_text_position,
'#options' => $options,
'#multiple' => FALSE,
'#required' => FALSE,
'#description' => t("Position of the slide text."),
'#weight' => 4,
);
$form['block_settings']['settings']['slide_text_settings']['slide_text_jquery'] = array(
'#type' => 'checkbox',
'#title' => t('Use jQuery effects for text of a slide'),
'#default_value' => $slide_text_jquery,
'#required' => FALSE,
'#description' => t("The jQuery effects will be added to the text in the Slide text container"),
'#weight' => 6,
);
//show fields when using jQuery effects for text of a slide
$extra = empty($slide_text_jquery) ? ' style="display:none"' : '';
// if the checkbox: jQuery effects for text of a slide is not checked, hide the advanced settings
$form['block_settings']['settings']['slide_text_settings']['slide_jquery'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#prefix' => '<div id="ddblock-slide-jquery-settings-wrapper"' . $extra . '>',
'#suffix' => '</div>',
'#title' => t('Slide text jquery settings'),
'#weight' => 7,
);
$easing_effect_options = _ddblock_get_easing_effects();
$before_effect_options = array(
'hide' => t('Basics - Hide'),
'fadeOut' => t('Fading - Fade Out'),
'slideUp' => t('Sliding - Slide Up'),
);
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_before_effect'] = array(
'#type' => 'select',
'#title' => t('Before effect'),
'#default_value' => $slide_text_before_effect,
'#options' => $before_effect_options,
'#multiple' => FALSE,
'#required' => FALSE,
'#description' => t("The before event is before a slide is shown, here the slidetext of the\nprevious slide will be hidden."),
);
$speed_options = drupal_map_assoc(array(
0,
250,
500,
1000,
2000,
3000,
4000,
5000,
));
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_before_speed'] = array(
'#type' => 'select',
'#title' => t('Speed before effect'),
'#default_value' => $slide_text_before_speed,
'#options' => $speed_options,
'#required' => FALSE,
'#description' => t("Speed of the before effect (1000 = 1 second, 0 = direct)."),
);
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_before_easing'] = array(
'#type' => 'select',
'#title' => t('Before easing'),
'#default_value' => $slide_text_before_easing,
'#options' => $easing_effect_options,
'#multiple' => FALSE,
'#required' => FALSE,
'#description' => t("Before easing effect of the slide text.<br />For easing effect examples, see: <a href=\"http://jqueryui.com/demos/effect/easing.html\" target=\"_blank\">easing demos</a>"),
);
$after_effect_options = array(
'show' => t('Basics - Show'),
'fadeIn' => t('Fading - Fade In'),
'slideDown' => t('Sliding - Slide Down'),
);
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_after_effect'] = array(
'#type' => 'select',
'#title' => t('After effect'),
'#default_value' => $slide_text_after_effect,
'#options' => $after_effect_options,
'#multiple' => FALSE,
'#required' => FALSE,
'#description' => t("The after event is after a slide is shown, here the slidetext of the\ncurrent slide will be shown."),
);
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_after_speed'] = array(
'#type' => 'select',
'#title' => t('Speed after effect'),
'#default_value' => $slide_text_after_speed,
'#options' => $speed_options,
'#required' => FALSE,
'#description' => t("Speed of the after effect (1000 = 1 second, 0 = direct)."),
);
$form['block_settings']['settings']['slide_text_settings']['slide_jquery']['slide_text_after_easing'] = array(
'#type' => 'select',
'#title' => t('After easing'),
'#default_value' => $slide_text_after_easing,
'#options' => $easing_effect_options,
'#multiple' => FALSE,
'#required' => FALSE,
'#description' => t("After easing effect of the slide text.<br />For easing effect examples, see: <a href=\"http://jqueryui.com/demos/effect/easing.html\" target=\"_blank\">easing demos</a>"),
);
if ($custom_jquery) {
$collapsed = FALSE;
}
else {
$collapsed = TRUE;
}
$form['block_settings']['settings']['custom'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#title' => t('Custom jQuery Cycle Plugin Settings'),
'#description' => t('If you use custom jQuery options, they will override your other settings.'),
);
$form['block_settings']['settings']['custom']['custom_jquery'] = array(
'#type' => 'textarea',
'#title' => t('Custom Options'),
'#default_value' => $custom_jquery,
'#cols' => 60,
'#rows' => 10,
'#required' => FALSE,
'#description' => t('Use valid JSON syntax, with double quotes for key/and string value pairs.<br />The total script needs to be enclosed in curly brackets.<br />No comma allowed after the last statement like in an array.<br />e.g.<br />{"fx":"fade",<br />"startingSlide":2,<br />"autostop":1}'),
);
$form_state['redirect'] = 'admin/structure/ddblock/list';
}
}
}