You are here

function fb_instant_articles_display_field_formatter_settings_form in Facebook Instant Articles 7.2

Same name and namespace in other branches
  1. 7 modules/fb_instant_articles_display/fb_instant_articles_display.module \fb_instant_articles_display_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

modules/fb_instant_articles_display/includes/field.inc, line 120
Field module functionality for Facebook Instant Articles Display module.

Code

function fb_instant_articles_display_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  switch ($display['type']) {
    case 'fbia_ad_formatter':
      $element['source'] = array(
        '#type' => 'select',
        '#title' => t('Source'),
        '#description' => t('Add your ad specifying the URL or embed the full unescaped HTML.'),
        '#default_value' => $settings['source'],
        '#options' => array(
          'url' => t('Ad URL'),
          'embed' => t('Embedded HTML'),
        ),
      );
      $element['height'] = array(
        '#type' => 'textfield',
        '#title' => t('Height'),
        '#description' => t('Height of the iframe element.'),
        '#default_value' => $settings['height'],
      );
      $element['width'] = array(
        '#type' => 'textfield',
        '#title' => t('Width'),
        '#description' => t('Width of the iframe element.'),
        '#default_value' => $settings['width'],
      );
      break;
    case 'fbia_interactive_formatter':
      $element['height'] = array(
        '#type' => 'textfield',
        '#title' => t('Height'),
        '#description' => t('The height of your interactive graphic.'),
        '#default_value' => $settings['height'],
      );
      $element['width'] = array(
        '#type' => 'select',
        '#title' => t('Width'),
        '#description' => t('The width of your interactive graphic.'),
        '#default_value' => $settings['width'],
        '#options' => array(
          'no-margin' => t('no-margin'),
          'column-width' => t('column-width'),
        ),
      );
      break;
    case 'fbia_list_formatter':
      $element['list_type'] = array(
        '#type' => 'select',
        '#title' => t('List Type'),
        '#description' => t('Choose list type.'),
        '#default_value' => $settings['list_type'],
        '#options' => array(
          'ol' => t('Ordered'),
          'ul' => t('Unordered'),
        ),
      );
      break;
    case 'fbia_image_formatter':
      $image_styles = image_style_options(FALSE, PASS_THROUGH);
      $element['style'] = array(
        '#title' => t('Image style'),
        '#type' => 'select',
        '#default_value' => $settings['style'],
        '#empty_option' => t('None (original image)'),
        '#options' => $image_styles,
      );
      $element['caption'] = array(
        '#type' => 'checkbox',
        '#description' => t('The caption uses the alt text of the image field.'),
        '#title' => t('Enable caption.'),
        '#default_value' => $settings['caption'],
      );
      $element['likes'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable Facebook Likes. (data-feedback)'),
        '#default_value' => $settings['likes'],
      );
      $element['comments'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable Facebook Comments. (data-feedback)'),
        '#default_value' => $settings['comments'],
      );
      $element['fullscreen'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable Fullscreen.'),
        '#default_value' => $settings['fullscreen'],
      );
      break;
    case 'fbia_analytics_formatter':
      $element['source'] = array(
        '#type' => 'select',
        '#title' => t('Source'),
        '#description' => t('Add your tracker specifying the URL or embed the full unescaped HTML.'),
        '#default_value' => $settings['source'],
        '#options' => array(
          'url' => t('Ad URL'),
          'embed' => t('Embedded HTML'),
        ),
      );
      break;
  }
  return $element;
}