You are here

function masonry_options_form in Masonry API 7

Add Masonry options to an existing form.

Parameters

$form: A form array to add Masonry options to.

$default_values: An array from which default form values can be obtained. Generally the same place form values are saved.

4 calls to masonry_options_form()
context_reaction_masonry::options_form in masonry_context/context_reaction_masonry.inc
Masonry settings form.
masonry_formatter_field_formatter_settings_form_alter in masonry_formatter/masonry_formatter.module
Implements hook_field_formatter_settings_form_alter().
masonry_form_search_admin_settings_alter in masonry_search/masonry_search.module
Implements hook_form_FORM_ID_alter() for search_admin_settings.
views_plugin_style_masonry_views_grid::options_form in masonry_views/views_plugin_style_masonry_views_grid.inc
Setup configuration form.

File

./masonry.module, line 71
Makes the 'jQuery Masonry' plugin available to Drupal as a library.

Code

function masonry_options_form(&$form, $default_values) {
  $form['masonry_width_unit'] = array(
    '#type' => 'radios',
    '#title' => t('Column width unit'),
    '#description' => t("The unit of measurement used for grid column widths."),
    '#options' => array(
      'px' => t('Pixels'),
      '%' => t("Percentage (of the container's width)"),
    ),
    '#default_value' => $default_values['masonry_width_unit'],
  );
  $form['masonry_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Column width'),
    '#description' => t("The width of each grid column."),
    '#default_value' => $default_values['masonry_width'],
    '#size' => 5,
    '#maxlength' => 4,
  );
  $form['masonry_animated'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable animations'),
    '#description' => t("When enabled, grid rearrangements are animated when the container is resized (see 'Make grid resizable' below)."),
    '#default_value' => $default_values['masonry_animated'],
  );
  $form['masonry_animated_duration'] = array(
    '#type' => 'textfield',
    '#title' => t('Duration'),
    '#description' => t("The duration of the animation in milliseconds (1000 ms = 1 sec)."),
    '#default_value' => $default_values['masonry_animated_duration'],
    '#size' => 5,
    '#maxlength' => 4,
    '#field_suffix' => t('ms'),
  );
  $form['masonry_resizable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Make grid resizable'),
    '#description' => t("When enabled, the grid will automatically rearrange itself if the container is resized."),
    '#default_value' => $default_values['masonry_resizable'],
  );
  $form['masonry_center'] = array(
    '#type' => 'checkbox',
    '#title' => t('Center grid'),
    '#description' => t("Centers the grid in the container element."),
    '#default_value' => $default_values['masonry_center'],
  );
  $form['masonry_gutter'] = array(
    '#type' => 'textfield',
    '#title' => t('Gutter width'),
    '#description' => t("The amount of spacing between each grid column in pixels."),
    '#default_value' => $default_values['masonry_gutter'],
    '#size' => 5,
    '#maxlength' => 3,
    '#field_suffix' => t('px'),
  );
  $form['masonry_rtl'] = array(
    '#type' => 'checkbox',
    '#title' => t('RTL layout'),
    '#description' => t("Displays grid items from right-to-left (for supporting languages like Hebrew and Arabic)."),
    '#default_value' => $default_values['masonry_rtl'],
  );
}