You are here

function dynamic_background_image_style_form in Dynamic Background 7.2

Same name and namespace in other branches
  1. 7 dynamic_background.module \dynamic_background_image_style_form()

Build the image style selection form, which can be used in sub-modules to add support for image manipulation.

Parameters

string $form_key:

Return value

type

7 calls to dynamic_background_image_style_form()
dynamic_background_blog_settings_form in modules/dynamic_background_blog/dynamic_background_blog.module
Build the administration interface for dynamic background nodes and enables administrators to select which content types have enable background selection.
dynamic_background_context_settings_form in modules/dynamic_background_context/dynamic_background_context.module
Build the administration interface for dynamic background context and enables administrators to set image style and css targets.
dynamic_background_node_settings_form in modules/dynamic_background_node/dynamic_background_node.module
Build the administration interface for dynamic background nodes.
dynamic_background_panels_settings_form in modules/dynamic_background_panels/dynamic_background_panels.module
Build the administration interface for dynamic background panels and enables administrators enter css to used for insertion of backgrounds.
dynamic_background_settings_form in ./dynamic_background.module
The dynamic background administration settings form.

... See full list

File

./dynamic_background.module, line 189
This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.

Code

function dynamic_background_image_style_form($form_key) {
  $form = array();
  $form[$form_key] = array(
    '#type' => 'fieldset',
    '#title' => t('Image style'),
    '#description' => 'You can apply differect effects to your background image using image styles. If you don\'t want to add effects to the selected background image, just select "No style".',
    '#collapsed' => FALSE,
    '#collapsible' => TRUE,
    '#tree' => TRUE,
  );

  // Get image style information.
  $options = array(
    0 => t('No style'),
  );
  $styles = image_styles();
  foreach ($styles as $stylename => $settings) {
    $options[$stylename] = $stylename;
  }

  // Load default form values (current selected image style).
  $default = variable_get($form_key, array());
  $form[$form_key]['style'] = array(
    '#type' => 'select',
    '#title' => t('Choose a style to apply to background images.'),
    '#description' => t('To create an image style, go to <a href="@url">image style configuration</a>.', array(
      '@url' => '/admin/config/media/image-styles',
    )),
    '#options' => $options,
    '#default_value' => isset($default['style']) ? $default['style'] : 0,
  );
  $form[$form_key]['thumbnail_style'] = array(
    '#type' => 'select',
    '#title' => t('Choose a style to apply to thumbnail images.'),
    '#description' => t('To create an image style, go to <a href="@url">image style configuration</a>.', array(
      '@url' => '/admin/config/media/image-styles',
    )),
    '#options' => $options,
    '#default_value' => isset($default['thumbnail_style']) ? $default['thumbnail_style'] : 'thumbnail',
  );
  return $form;
}