function field_orbit_field_formatter_settings_form in ZURB Orbit 7
Same name and namespace in other branches
- 7.2 field_orbit.module \field_orbit_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
field_orbit.module, line 47 - Implement a orbit formatter for fields.
Code
function field_orbit_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element['orbit'] = array(
'#type' => 'fieldset',
'#title' => t('Orbit settings'),
);
$element['orbit']['animation'] = array(
'#type' => 'select',
'#title' => t('Animation'),
'#default_value' => $settings['animation'],
'#options' => array(
'fade' => t('fade'),
'horizontal-slide' => t('horizontal-slide'),
'vertical-slide' => t('vertical-slide'),
'horizontal-push' => t('horizontal-push'),
),
);
$element['orbit']['animationSpeed'] = array(
'#type' => 'textfield',
'#title' => t('Animation speed'),
'#default_value' => $settings['animationSpeed'],
'#element_validate' => array(
'element_validate_integer_positive',
),
);
$element['orbit']['timer'] = array(
'#type' => 'checkbox',
'#title' => t('Timer'),
'#default_value' => $settings['timer'],
);
$element['orbit']['resetTimerOnClick'] = array(
'#type' => 'checkbox',
'#title' => t('Reset timer on click'),
'#default_value' => $settings['resetTimerOnClick'],
'#description' => t('Resets the timer instead of pausing slideshow progress'),
);
$element['orbit']['advanceSpeed'] = array(
'#type' => 'textfield',
'#title' => t('Advance speed'),
'#default_value' => $settings['advanceSpeed'],
'#element_validate' => array(
'element_validate_integer_positive',
),
);
$element['orbit']['pauseOnHover'] = array(
'#type' => 'checkbox',
'#title' => t('Pause on hover'),
'#default_value' => $settings['pauseOnHover'],
'#description' => t('If you hover pauses the slider'),
);
$element['orbit']['startClockOnMouseOut'] = array(
'#type' => 'checkbox',
'#title' => t('Start clock on mouseOut'),
'#default_value' => $settings['startClockOnMouseOut'],
'#description' => t('If clock should start on MouseOut'),
);
$element['orbit']['startClockOnMouseOutAfter'] = array(
'#type' => 'textfield',
'#title' => t('Start clock on mouseOut after'),
'#default_value' => $settings['startClockOnMouseOutAfter'],
'#element_validate' => array(
'element_validate_integer_positive',
),
);
$element['orbit']['directionalNav'] = array(
'#type' => 'checkbox',
'#title' => t('Directional nav'),
'#default_value' => $settings['directionalNav'],
'#description' => t('Manual advancing directional navs'),
);
$element['orbit']['captions'] = array(
'#type' => 'checkbox',
'#title' => t('Captions'),
'#default_value' => $settings['captions'],
);
$element['orbit']['captionAnimation'] = array(
'#type' => 'select',
'#title' => t('Caption animation'),
'#default_value' => $settings['captionAnimation'],
'#options' => array(
'fade' => t('fade'),
'slideOpen' => t('slideOpen'),
'none' => t('none'),
),
);
$element['orbit']['captionAnimationSpeed'] = array(
'#type' => 'textfield',
'#title' => t('Caption animation speed'),
'#default_value' => $settings['captionAnimationSpeed'],
'#element_validate' => array(
'element_validate_integer_positive',
),
);
$element['orbit']['bullets'] = array(
'#type' => 'checkbox',
'#title' => t('Bullets'),
'#default_value' => $settings['bullets'],
'#description' => t('Activate the bullet navigation'),
);
$element['orbit']['bulletThumbs'] = array(
'#type' => 'checkbox',
'#title' => t('Bullet thumbnails'),
'#default_value' => $settings['bulletThumbs'],
);
$element['orbit']['bulletThumbLocation'] = array(
'#type' => 'textfield',
'#title' => t('Bullet thumbnail location'),
'#default_value' => $settings['bulletThumbLocation'],
);
$element['orbit']['fluid'] = array(
'#type' => 'checkbox',
'#title' => t('Fluid'),
'#default_value' => $settings['fluid'],
);
if ($field['type'] == 'field_collection') {
$element['orbit_field_collection_image'] = array(
'#title' => t('Image field'),
'#type' => 'select',
'#default_value' => $settings['orbit_field_collection_image'],
'#empty_option' => t('None'),
'#options' => _field_orbit_get_fields(array(
'image',
'imagefield_crop',
), $field['type'], $field['field_name']),
'#required' => TRUE,
);
}
$element['orbit_image_style'] = array(
'#title' => t('Image style'),
'#type' => 'select',
'#default_value' => $settings['orbit_image_style'],
'#empty_option' => t('None (original image)'),
'#options' => image_style_options(FALSE),
);
$links = array(
'content' => t('Content'),
'file' => t('File'),
);
if ($field['type'] == 'media' || $field['type'] == 'field_collection') {
$links += _field_orbit_get_fields(array(
'link_field',
'node_reference',
), $field['type'], $field['field_name']);
}
$element['orbit_link'] = array(
'#title' => t('Link image to'),
'#type' => 'select',
'#default_value' => $settings['orbit_link'],
'#empty_option' => t('Nothing'),
'#options' => $links,
);
if ($field['type'] == 'media' || $field['type'] == 'field_collection') {
$captions = _field_orbit_get_fields(array(
'text',
), $field['type'], $field['field_name']);
}
else {
$captions = array(
'title' => t('Title text'),
'alt' => t('Alt text'),
);
}
$element['orbit_caption'] = array(
'#title' => t('Caption'),
'#type' => 'select',
'#default_value' => $settings['orbit_caption'],
'#empty_option' => t('Nothing'),
'#options' => $captions,
);
$element['orbit_caption_link'] = array(
'#title' => t('Caption link'),
'#type' => 'select',
'#default_value' => $settings['orbit_caption_link'],
'#empty_option' => t('Nothing'),
'#options' => $links,
'#states' => array(
'invisible' => array(
':input[name$="[settings_edit_form][settings][orbit_caption]"]' => array(
'value' => '',
),
),
),
);
return $element;
}