Пример #1
0
function surreal_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Work-around for this bug: https://drupal.org/node/1862892
    $theme_settings_path = drupal_get_path('theme', 'surreal') . '/theme-settings.php';
    if (file_exists($theme_settings_path) && !in_array($theme_settings_path, $form_state['build_info']['files'])) {
        $form_state['build_info']['files'][] = $theme_settings_path;
    }
    $form['theme_settings']['#collapsible'] = TRUE;
    $form['theme_settings']['#collapsed'] = TRUE;
    $form['theme_settings']['#weight'] = 10;
    $form['logo']['#collapsible'] = TRUE;
    $form['logo']['#collapsed'] = TRUE;
    $form['logo']['#weight'] = 11;
    $form['favicon']['#collapsible'] = TRUE;
    $form['favicon']['#collapsed'] = TRUE;
    $form['favicon']['#weight'] = 12;
    //Background slider
    $form['banner'] = array('#type' => 'fieldset', '#title' => t('Web site background Slideshow'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#weight' => -2);
    //BACKGROUND 1
    $form['banner']['images'] = array('#type' => 'fieldset', '#title' => t('First slide'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Image upload section ======================================================
    $banners = surreal_get_banners();
    $form['banner']['images'] = array('#type' => 'vertical_tabs', '#title' => t('Banner images'), '#weight' => -1, '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE);
    $i = 0;
    foreach ($banners as $image_data) {
        $form['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' => _surreal_banner_form($image_data));
        $i++;
    }
    $form['banner']['image_upload'] = array('#type' => 'file', '#title' => t('Upload a new slide'), '#weight' => $i);
    $form['frontpage'] = array('#type' => 'fieldset', '#title' => t('One page settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#weight' => 0);
    // Region 1
    $form['frontpage']['region1'] = array('#type' => 'fieldset', '#title' => t('About (region #1)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 1);
    $form['frontpage']['region1']['region1Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region1Name', 'surreal'));
    $form['frontpage']['region1']['region1Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region1Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region1']['parallax_fg_region1_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region1_image', 'surreal'));
    $form['frontpage']['region1']['parallax_bg_region1_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region1_image', 'surreal'));
    // Region 2
    $form['frontpage']['region2'] = array('#type' => 'fieldset', '#title' => t('Services (region #2)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 2);
    $form['frontpage']['region2']['region2Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region2Name', 'surreal'));
    $form['frontpage']['region2']['region2Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region2Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region2']['parallax_fg_region2_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region2_image', 'surreal'));
    $form['frontpage']['region2']['parallax_bg_region2_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region2_image', 'surreal'));
    // Region 3
    $form['frontpage']['region3'] = array('#type' => 'fieldset', '#title' => t('Our People (region #3)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 3);
    $form['frontpage']['region3']['region3Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region3Name', 'surreal'));
    $form['frontpage']['region3']['region3Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region3Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region3']['parallax_fg_region3_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region3_image', 'surreal'));
    $form['frontpage']['region3']['parallax_bg_region3_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region3_image', 'surreal'));
    // Region 4
    $form['frontpage']['region4'] = array('#type' => 'fieldset', '#title' => t('Portfolio (region #4)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 4);
    $form['frontpage']['region4']['region4Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region4Name', 'surreal'));
    $form['frontpage']['region4']['region4Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region4Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region4']['parallax_fg_region4_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region4_image', 'surreal'));
    $form['frontpage']['region4']['parallax_bg_region4_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region4_image', 'surreal'));
    // Region 5
    $form['frontpage']['region5'] = array('#type' => 'fieldset', '#title' => t('Careers (region #5)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 5);
    $form['frontpage']['region5']['region5Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region5Name', 'surreal'));
    $form['frontpage']['region5']['region5Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region5Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region5']['parallax_fg_region5_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region5_image', 'surreal'));
    $form['frontpage']['region5']['parallax_bg_region5_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region5_image', 'surreal'));
    // Region 6
    $form['frontpage']['region6'] = array('#type' => 'fieldset', '#title' => t('Contact (region #6)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 6);
    $form['frontpage']['region6']['region6Name'] = array('#type' => 'textfield', '#title' => t("Page title"), '#default_value' => theme_get_setting('region6Name', 'surreal'));
    $form['frontpage']['region6']['region6Description'] = array('#type' => 'textarea', '#title' => t("Page description"), '#default_value' => theme_get_setting('region6Description', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region6']['parallax_fg_region6_image'] = array('#type' => 'managed_file', '#title' => t('Upload Foreground'), '#description' => t('The image should be on a transparent background for proper effect'), '#upload_location' => 'public://parallax/foreground/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_fg_region6_image', 'surreal'));
    $form['frontpage']['region6']['parallax_bg_region6_image'] = array('#type' => 'managed_file', '#title' => t('Upload Background'), '#description' => t('The image should tile horizontally for proper effect'), '#upload_location' => 'public://parallax/background/', '#progress_indicator' => 'bar', '#default_value' => theme_get_setting('parallax_bg_region6_image', 'surreal'));
    $form['frontpage']['region6']['contact-page'] = array('#type' => 'fieldset', '#title' => t('Contact Form'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['frontpage']['region6']['contact-page']['contact-info'] = array('#type' => 'textarea', '#title' => t('Information'), '#default_value' => theme_get_setting('contact-info', 'surreal'), '#format' => 'full_html');
    $form['frontpage']['region6']['contact-page']['contact-map'] = array('#type' => 'textfield', '#title' => t('Building'), '#description' => t('Example: Abney Hall'), '#default_value' => theme_get_setting('contact-map', 'surreal'));
    $form['frontpage']['region6']['contact-page']['contact-map-region'] = array('#type' => 'textfield', '#title' => t('Address 1'), '#description' => t('Example: Manchester Rd'), '#default_value' => theme_get_setting('contact-map-region', 'surreal'));
    $form['frontpage']['region6']['contact-page']['contact-map-county'] = array('#type' => 'textfield', '#title' => t('County'), '#description' => t('Example: Cheadle'), '#default_value' => theme_get_setting('contact-map-county', 'surreal'));
    $form['frontpage']['region6']['contact-page']['contact-map-area'] = array('#type' => 'textfield', '#title' => t('Postcode'), '#description' => t('Example: SK8 2PD'), '#default_value' => theme_get_setting('contact-map-area', 'surreal'));
    $form['frontpage']['region6']['contact-page']['map'] = array('#title' => t('Contact Map'));
    $form['frontpage']['region6']['contact-page']['contact-map-zoom'] = array('#type' => 'textfield', '#title' => t('Zoom map'), '#default_value' => theme_get_setting('contact-map-zoom', 'surreal'), '#description' => 'Min value: 1, Max value: 20. Default value 10');
    $form['frontpage']['region6']['contact-page']['contact-map-status'] = array('#type' => 'checkbox', '#title' => t('Show map on contact page'), '#default_value' => theme_get_setting('contact-map-status', 'surreal'));
    $form['frontpage']['region6']['contact-page']['contact-phone'] = array('#type' => 'textfield', '#title' => t('Phone'), '#default_value' => theme_get_setting('contact-phone', 'surreal'));
    $form['frontpage']['region6']['contact-page']['contact-email'] = array('#type' => 'textfield', '#title' => t('Email'), '#default_value' => theme_get_setting('contact-email', 'surreal'));
    $form['#submit'][] = 'surreal_settings_submit';
}
Пример #2
0
function surreal_show_banners()
{
    $banners = surreal_get_banners(FALSE);
    $slideshowSpeed = check_plain(theme_get_setting('slideshowSpeed', 'surreal'));
    $slideshowEffect = check_plain(theme_get_setting('slideshowEffect', 'surreal'));
    $backgroundButtonText = check_plain(theme_get_setting('backgroundButtonText', 'surreal'));
    $output = "\$(document).ready(function() {\r\n        \r\n    \$.supersized({\r\n\r\n\t\t// Functionality\r\n\t\tslideshow               :   1,\t\t\t// Slideshow on/off\r\n\t\tautoplay\t\t\t\t:\t1,\t\t\t// Slideshow starts playing automatically\r\n\t\tstart_slide             :   1,\t\t\t// Start slide (0 is random)\r\n\t\tstop_loop\t\t\t\t:\t0,\t\t\t// Pauses slideshow on last slide\r\n\t\trandom\t\t\t\t\t:\t0,\t\t\t// Randomize slide order (Ignores start slide)\r\n\t\tslide_interval          :   5000,\t\t// Length between transitions\r\n\t\ttransition\t\t\t\t:\t2, \t\t\t// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left\r\n\t\ttransition_speed\t\t:\t600,\t\t// Speed of transition\r\n\t\tnew_window\t\t\t\t:\t1,\t\t\t// Image links open in new window/tab\r\n\t\tpause_hover             :   0,\t\t\t// Pause slideshow on hover\r\n\t\tkeyboard_nav            :   1,\t\t\t// Keyboard navigation on/off\r\n\t\tperformance\t\t\t\t:\t1,\t\t\t// 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)\r\n\t\timage_protect\t\t\t:\t1,\t\t\t// Disables image dragging and right click with Javascript\r\n\r\n\t\t// Size & Position\t\t\t\t\t\t   \r\n\t\tmin_width\t\t        :   0,\t\t\t// Min width allowed (in pixels)\r\n\t\tmin_height\t\t        :   0,\t\t\t// Min height allowed (in pixels)\r\n\t\tvertical_center         :   1,\t\t\t// Vertically center background\r\n\t\thorizontal_center       :   1,\t\t\t// Horizontally center background\r\n\t\tfit_always\t\t\t\t:\t0,\t\t\t// Image will never exceed browser width or height (Ignores min. dimensions)\r\n\t\tfit_portrait         \t:\t1,\t\t\t// Portrait images will not exceed browser height\r\n\t\tfit_landscape\t\t\t:   0,\t\t\t// Landscape images will not exceed browser width\r\n\r\n\t\t// Components\t\t\t\t\t\t\t\r\n\t\tslide_links\t\t\t\t:\t'blank',\t// Individual links for each slide (Options: false, 'num', 'name', 'blank')\r\n\t\tthumb_links\t\t\t\t:\t0,\t\t\t// Individual thumb links for each slide\r\n\t\tthumbnail_navigation    :   0,\t\t\t// Thumbnail navigation\r\n\t\tslides \t\t\t\t\t:\t[\t\t\t// Slideshow Images\r\n\t\t\t";
    for ($i = 0; $i < count($banners); $i++) {
        $output .= '{ 
					"image" : "' . file_create_url($banners[$i]['image_path']) . '",
					"title" : "' . "<h2>" . fancy_title(t('@image_title', array('@image_title' => t($banners[$i]['image_title'])))) . "</h2>" . '",
				},';
    }
    $output .= "\r\n\t\t],\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t// Theme Options\t\t\t   \r\n\t\tprogress_bar\t\t\t:\t0,\t\t\t// Timer for each slide\t\t\t\t\t\t\t\r\n\t\tmouse_scrub\t\t\t\t:\t0\r\n\r\n\t});\r\n\t});";
    variable_set("SlideShowScript", $output);
}