You are here

function context_reaction_masonry::options_form in Masonry API 7

Masonry settings form.

Overrides context_reaction::options_form

File

masonry_context/context_reaction_masonry.inc, line 15
Masonry reaction for Context module.

Class

context_reaction_masonry
Adds Masonry javascript to the page.

Code

function options_form($context) {
  $form = array();
  $settings = $this
    ->fetch_from_context($context);

  // Get default Masonry options
  $settings += masonry_default_options();
  $form['container'] = array(
    '#type' => 'textfield',
    '#title' => t('Container'),
    '#default_value' => isset($settings['container']) ? $settings['container'] : NULL,
    '#description' => t('The jQuery selector of the Masonry container (ie, .region-content-inner).'),
  );
  $form['item'] = array(
    '#type' => 'textfield',
    '#title' => t('Item selector'),
    '#default_value' => isset($settings['item']) ? $settings['item'] : NULL,
    '#description' => t('The jQuery selector of the Masonry item container (ie, section).'),
  );

  // Add Masonry options to an existing form
  masonry_options_form($form, $settings);
  $form['masonry_animated_duration']['#states'] = array(
    'visible' => array(
      'input.form-checkbox[name$="[masonry_animated]"]' => array(
        'checked' => TRUE,
      ),
    ),
  );
  return $form;
}