Beispiel #1
0
/**
 * Advanced theme settings.
 */
function engageny_form_system_theme_settings_alter(&$form, $form_state)
{
    $form['slider'] = array('#type' => 'fieldset', '#title' => t('Slider managment'), '#collapsible' => TRUE, '#collapsed' => FALSE);
    $form['slider']['slider_display'] = array('#type' => 'select', '#title' => t('Show slider?'), '#options' => array('0' => 'No', '1' => 'Yes'), '#default_value' => theme_get_setting('slider_display'));
    if (theme_get_setting('slider_display')) {
        $form['slider']['configuration'] = array('#type' => 'fieldset', '#title' => t('Slider configuration'), '#collapsible' => TRUE, '#collapsed' => TRUE);
        $form['slider']['configuration']['slider_use'] = array('#type' => 'select', '#options' => array(1 => t('Polaroid'), 0 => t('NivoSlider')), '#title' => t('Select slider you want to use'), '#default_value' => theme_get_setting('slider_use'));
        $slider_use = theme_get_setting('slider_use');
        if ($slider_use == 0) {
            $form['slider']['configuration']['nivo'] = array('#type' => 'fieldset', '#title' => t('Nivoslider configuration'), '#collapsible' => TRUE, '#collapsed' => FALSE);
            $form['slider']['configuration']['nivo']['nivo_effect'] = array('#type' => 'textfield', '#title' => t('Effect'), '#description' => t('Specify sets like: \'random,fold,fade,sliceDown\''), '#default_value' => theme_get_setting('nivo_effect'));
            $form['slider']['configuration']['nivo']['nivo_slices'] = array('#type' => 'textfield', '#title' => t('Slices'), '#description' => t('For slice animations'), '#default_value' => theme_get_setting('nivo_slices'));
            $form['slider']['configuration']['nivo']['nivo_boxCols'] = array('#type' => 'textfield', '#title' => t('Box Cols'), '#description' => t('For box animations'), '#default_value' => theme_get_setting('nivo_boxCols'));
            $form['slider']['configuration']['nivo']['nivo_boxRows'] = array('#type' => 'textfield', '#title' => t('box Rows'), '#description' => t('For box animations'), '#default_value' => theme_get_setting('nivo_boxRows'));
            $form['slider']['configuration']['nivo']['nivo_animSpeed'] = array('#type' => 'textfield', '#title' => t('Animal Speed'), '#description' => t('Slide transition speed'), '#default_value' => theme_get_setting('nivo_animSpeed'));
            $form['slider']['configuration']['nivo']['nivo_pauseTime'] = array('#type' => 'textfield', '#title' => t('Pause Time'), '#description' => t('How long each slide will show'), '#default_value' => theme_get_setting('nivo_pauseTime'));
            $form['slider']['configuration']['nivo']['nivo_directionNav'] = array('#type' => 'select', '#options' => array('true' => 'Yes', 'false' => 'No'), '#title' => t('Direction Navigation'), '#description' => t('Next & Prev navigation'), '#default_value' => theme_get_setting('nivo_directionNav'));
            $form['slider']['configuration']['nivo']['nivo_controlNav'] = array('#type' => 'select', '#options' => array('true' => 'Yes', 'false' => 'No'), '#title' => t('Control Navigation'), '#description' => t('1,2,3... navigation'), '#default_value' => theme_get_setting('nivo_controlNav'));
            $form['slider']['configuration']['nivo']['nivo_keyboardNav'] = array('#type' => 'select', '#options' => array('true' => 'Yes', 'false' => 'No'), '#title' => t('keyboard Navigation'), '#default_value' => theme_get_setting('nivo_keyboardNav'));
            $form['slider']['configuration']['nivo']['nivo_pauseOnHover'] = array('#type' => 'select', '#options' => array('true' => 'Yes', 'false' => 'No'), '#title' => t('Pause on Hover'), '#default_value' => theme_get_setting('nivo_pauseOnHover'));
            $form['slider']['configuration']['nivo']['nivo_captionOpacity'] = array('#type' => 'textfield', '#title' => t('Caption Opacity, ex: 0.7'), '#default_value' => theme_get_setting('nivo_captionOpacity'));
        }
        $slider_text = theme_get_setting('slider_left_text');
        $form['slider']['configuration']['slider_left_text'] = array('#type' => 'textarea', '#title' => t('Slider text on left'), '#default_value' => $slider_text);
        // Image upload section ======================================================
        $banners = engageny_get_banners();
        $form['slider']['banner']['images'] = array('#type' => 'vertical_tabs', '#title' => t('Banner images'), '#weight' => 2, '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE);
        $i = 0;
        foreach ($banners as $image_data) {
            $form['slider']['banner']['images'][$i] = array('#type' => 'fieldset', '#title' => t('Image !number: !title', array('!number' => $i + 1, '!title' => $image_data['image_title'])), '#weight' => $i, '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE, 'image' => _engageny_banner_form($image_data));
            $i++;
        }
        $form['slider']['banner']['image_upload'] = array('#type' => 'file', '#title' => t('Upload a new image'), '#weight' => $i);
        $form['#submit'][] = 'engageny_settings_submit';
    }
    return $form;
}
Beispiel #2
0
/**
 * Get banner to show into current page in accord with settings
 *
 * @return <array>
 *    Banners to show
 */
function engageny_show_banners()
{
    $banners = engageny_get_banners(FALSE);
    $display_banners = array();
    // Current path alias
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
    // Check visibility for each banner
    foreach ($banners as $banner) {
        // Pages
        $pages = drupal_strtolower($banner['image_visibility']);
        // Check path for alias, and (if required) for path
        $page_match = drupal_match_path($path, $pages);
        if ($path != $_GET['q']) {
            $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
        }
        // Add banner to visible banner
        if ($page_match) {
            $display_banners[] = $banner;
        }
    }
    return $display_banners;
}