AlkantarClanX12

Your IP : 216.73.217.128


Current Path : /var/www/clients/client1/web1/web/sites/all/themes/hawell/
Upload File :
Current File : /var/www/clients/client1/web1/web/sites/all/themes/hawell/theme-settings.php

<?php

function hawell_form_system_theme_settings_alter(&$form, &$form_state) {

  $form['#submit'][] = 'hawell_settings_form_submit';

  // Get all themes.
  $themes = list_themes();
  // Get the current theme
  $active_theme = $GLOBALS['theme_key'];
  $form_state['build_info']['files'][] = str_replace("/$active_theme.info", '', $themes[$active_theme]->filename) . '/theme-settings.php';

  $theme_path = drupal_get_path('theme', 'hawell');
  $form['settings'] = array(
      '#type' => 'vertical_tabs',
      '#title' => t('Theme settings'),
      '#weight' => 2,
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

  $form['settings']['general_setting'] = array(
      '#type' => 'fieldset',
      '#title' => t('General Settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

  $form['settings']['general_setting']['text_logo'] = array(
      '#type' => 'textfield',
      '#title' => t('Text logo'),
      '#default_value' => theme_get_setting('text_logo', 'hawell'),
  );

  $form['settings']['general_setting']['homepage_style'] = array(
      '#title' => t('Homepage style'),
      '#type' => 'select',
      '#options' => array(
        'default' => t('Default'),
        'blog1' => t('Blog Layout 1'),
        'blog2' => t('Blog Layout 2'),
        'magazine' => t('Magazine'),
        'landing' => t('Landing Layout'),
        'onepage' => t('One page'),
      ),
      '#default_value' => theme_get_setting('homepage_style', 'hawell'),
  );

  $form['settings']['general_setting']['home_boxed'] = array(
      '#type' => 'select',
      '#title' => t('Boxed'),
      '#options' => array(
        'no' => t('No'),
        'yes' => t('Yes'),
        ),
      '#default_value' => theme_get_setting('home_boxed', 'hawell'),
  );


  $form['settings']['general_setting']['general_setting_tracking_code'] = array(
      '#type' => 'textarea',
      '#title' => t('Tracking Code'),
      '#default_value' => theme_get_setting('general_setting_tracking_code', 'hawell'),
  );


  $form['settings']['general_setting']['map_icon'] = array(
    '#type'     => 'managed_file',
    '#title'    => t('Location marker map icon '),
    '#required' => FALSE,
    '#upload_location' => 'public://background-icon/',
    '#default_value' => theme_get_setting('map_icon','hawell'),
    '#upload_validators' => array(
    'file_validate_extensions' => array('gif png jpg jpeg'),
    ),
  );

  $form['settings']['header'] = array(
      '#type' => 'fieldset',
      '#title' => t('Header settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

   $form['settings']['header']['header_style'] = array(

      '#title' => t('Header style'),

      '#type' => 'select',

      '#options' => array(
        'header1' => t('Black Transparent'),
        'header2' => t('White Transparent'),
        'header2b' => t('White Mobile Transparent'),
        'header3' => t('White No Transparent'),
        'header4' => t('Black No Transparent'),
        'header5' => t('Side Menu'),
        'header6' => t('Min Menu'),
        'header7' => t('Min Menu 2'),
        'header8' => t('Black Min Menu 2'),
        'header9' => t('Top Bar 1'),
        'header10' => t('Top Bar 2'),
      ),

      '#default_value' => theme_get_setting('header_style', 'hawell'),

  );

   $form['settings']['header']['phone_contact'] = array(
      '#type' => 'textfield',
      '#title' => t('Phone contact'),
      '#default_value' => theme_get_setting('phone_contact', 'hawell'),
  );


  $form['settings']['header']['contact_email'] = array(
      '#type' => 'textfield',
      '#title' => t('Contact email'),
      '#default_value' => theme_get_setting('contact_email', 'hawell'),
      '#description'  => t('Email contact, support')
  );

  $form['settings']['header']['work_hours'] = array(
      '#type' => 'textfield',
      '#title' => t('working hours'),
      '#default_value' => theme_get_setting('work_hours', 'hawell'),
  );


  $form['settings']['portfolio'] = array(
      '#type' => 'fieldset',
      '#title' => t('Portfolio settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

  $form['settings']['portfolio']['portfolio_style'] = array(

      '#title' => t('Portfolio style'),

      '#type' => 'select',

      '#options' => array(

        'grid' => t('Portfolio Grid'),
        'boxed_2col' => t('Boxed 2 Columns'),
        'boxed_3col' => t('Boxed 3 Columns'),
        'boxed_4col' => t('Boxed 4 Columns'),
        'boxed_5col' => t('Boxed 5 Columns'),
        'boxed_gut_2col' => t('Boxed Bordered 2 Columns'),
        'boxed_gut_3col' => t('Boxed Bordered 3 Columns'),
        'boxed_gut_4col' => t('Boxed Bordered 4 Columns'),
        'wide_2col' => t('Wide 2 Columns'),
        'wide_3col' => t('Wide 3 Columns'),
        'wide_4col' => t('Wide 4 Columns'),
        'wide_5col' => t('Wide 5 Columns'),
        'wide_gut_2col' => t('Wide Bordered 2 Columns'),
        'wide_gut_3col' => t('Wide Bordered 3 Columns'),
        'wide_gut_4col' => t('Wide Bordered 4 Columns'),
        'wide_gut_5col' => t('Wide Bordered 5 Columns'),
        'masonry_2col' => t('Masonry 2 Columns'),
        'masonry_3col' => t('Masonry 3 Columns'),
        'masonry_4col' => t('Masonry 4 Columns'),
        'masonry_5col' => t('Masonry 5 Columns'),
      ),

      '#default_value' => theme_get_setting('portfolio_style', 'hawell'),

  );

  $form['settings']['shop'] = array(
      '#type' => 'fieldset',
      '#title' => t('Shop settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

  $form['settings']['shop']['shop_style'] = array(

      '#title' => t('Shop style'),

      '#type' => 'select',

      '#options' => array(

        '2col' => t('2 Columns'),
        '3col' => t('3 Columns'),
        '4col' => t('4 Columns'),
      ),

      '#default_value' => theme_get_setting('shop_style', 'hawell'),

  );

  $form['settings']['shop']['shop_background_breadcrumb'] = array(
    '#type'     => 'managed_file',
    '#title'    => t('Shop breadcrumb background '),
    '#required' => FALSE,
    '#upload_location' => 'public://background-icon/',
    '#default_value' => theme_get_setting('shop_background_breadcrumb','hawell'),
    '#upload_validators' => array(
    'file_validate_extensions' => array('gif png jpg jpeg'),
    ),
  );


   $form['settings']['blog'] = array(
      '#type' => 'fieldset',
      '#title' => t('Blog settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

   $form['settings']['blog']['blog_style'] = array(

      '#title' => t('Blog style'),

      '#type' => 'select',

      '#options' => array(

        'masonry_2col' => t('Masonry 2 Columns'),
        'masonry_3col' => t('Masonry 3 Columns'),
        'masonry_4col' => t('Masonry 4 Columns'),
        'full_width' => t('Blog Full Width'),
        'small_image' => t('Blog Small Image'),
        'right' => t('Blog Right Sidebar'),
        'left' => t('Blog Left Sidebar'),
      ),

      '#default_value' => theme_get_setting('blog_style', 'hawell'),

  );

   $form['settings']['blog']['blog_background_breadcrumb'] = array(
    '#type'     => 'managed_file',
    '#title'    => t('Blog breadcrumb background '),
    '#required' => FALSE,
    '#upload_location' => 'public://background-icon/',
    '#default_value' => theme_get_setting('blog_background_breadcrumb','hawell'),
    '#upload_validators' => array(
    'file_validate_extensions' => array('gif png jpg jpeg'),
    ),
  );


  $form['settings']['footer'] = array(
      '#type' => 'fieldset',
      '#title' => t('Footer settings'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
  );

  $form['settings']['footer']['footer_style'] = array(
      '#title' => t('Footer style'),
      '#type' => 'select',
      '#options' => array(
        'footer1' => t('Footer style 1'),
        'footer2' => t('Footer style 2'),
        'footer3' => t('Footer style 3'),
      ),
      '#default_value' => theme_get_setting('footer_style', 'hawell'),
  );


  $form['settings']['footer']['footer_copyright_message'] = array(
      '#type' => 'textarea',
      '#title' => t('Footer copyright message'),
      '#default_value' => theme_get_setting('footer_copyright_message', 'hawell'),
  );


	$form['settings']['custom_css'] = array(
		  '#type' => 'fieldset',
		  '#title' => t('Custom CSS'),
		  '#collapsible' => TRUE,
		  '#collapsed' => FALSE,
	  );

	$form['settings']['custom_css']['custom_css'] = array(
		  '#type' => 'textarea',
		  '#title' => t('Custom CSS'),
		  '#default_value' => theme_get_setting('custom_css', 'hawell'),
		  '#description'  => t('<strong>Example:</strong><br/>h1 { font-family: \'Metrophobic\', Arial, serif; font-weight: 400; }')
	  );

}

function hawell_settings_form_submit(&$form, $form_state) {

  $image_fid = $form_state['values']['map_icon'];
  $image_fid2 = $form_state['values']['blog_background_breadcrumb'];
  $image_fid3 = $form_state['values']['shop_background_breadcrumb'];
  $image1 = file_load($image_fid);
  $image2 = file_load($image_fid2);
  $image3 = file_load($image_fid3);

  if (is_object($image1)) {
  // Check to make sure that the file is set to be permanent.
    if ($image1->status == 0) {
    // Update the status.
    $image1->status = FILE_STATUS_PERMANENT;
    // Save the update.
    file_save($image1);
    // Add a reference to prevent warnings.
    file_usage_add($image1, 'hawell', 'theme', 1);
    }
  }

  if (is_object($image2)) {
  // Check to make sure that the file is set to be permanent.
    if ($image2->status == 0) {
    // Update the status.
    $image2->status = FILE_STATUS_PERMANENT;
    // Save the update.
    file_save($image2);
    // Add a reference to prevent warnings.
    file_usage_add($image2, 'hawell', 'theme', 1);
    }
  }

  if (is_object($image3)) {
  // Check to make sure that the file is set to be permanent.
    if ($image3->status == 0) {
    // Update the status.
    $image3->status = FILE_STATUS_PERMANENT;
    // Save the update.
    file_save($image3);
    // Add a reference to prevent warnings.
    file_usage_add($image3, 'hawell', 'theme', 1);
    }
  }

}