You are here

function socialfeed_facebook_settings in Social Feed 7.2

Same name and namespace in other branches
  1. 7 socialfeed.admin.inc \socialfeed_facebook_settings()

Form builder; Configure social feeds settings for this site.

See also

system_settings_form()

1 string reference to 'socialfeed_facebook_settings'
socialfeed_menu in ./socialfeed.module
Implements hook_menu().

File

./socialfeed.admin.inc, line 17
Social Feed module admin inc file.

Code

function socialfeed_facebook_settings($form, &$form_state) {
  $form['socialfeed_facebook_page_name'] = [
    '#type' => 'textfield',
    '#title' => t('Facebook Page Name'),
    '#default_value' => variable_get('socialfeed_facebook_page_name'),
    '#description' => t('eg. If your Facebook page URL is this http://www.facebook.com/YOUR_PAGE_NAME, <br />then you just need to add this YOUR_PAGE_NAME above OR find your Facebook Page ID <a href="@here" target="@blank">here</a>.', [
      '@here' => 'http://findmyfbid.com/',
      '@blank' => '_blank',
    ]),
    '#size' => 60,
    '#maxlength' => 100,
    '#required' => TRUE,
  ];
  $form['socialfeed_facebook_app_id'] = [
    '#type' => 'textfield',
    '#title' => t('Facebook App ID'),
    '#default_value' => variable_get('socialfeed_facebook_app_id'),
    '#description' => t('Create your Facebook app and visit <a href="@this" target="@blank">this link</a> to get App ID.', [
      '@this' => 'https://developers.facebook.com/apps',
      '@blank' => '_blank',
    ]),
    '#size' => 60,
    '#maxlength' => 100,
    '#required' => TRUE,
  ];
  $form['socialfeed_facebook_secret_key'] = [
    '#type' => 'textfield',
    '#title' => t('Facebook Secret Key'),
    '#default_value' => variable_get('socialfeed_facebook_secret_key'),
    '#description' => t('<a href="@this" target="@blank"> This link</a> will help you to find out your App Secret Key.', [
      '@this' => 'https://developers.facebook.com/apps',
      '@blank' => '_blank',
    ]),
    '#size' => 60,
    '#maxlength' => 100,
    '#required' => TRUE,
  ];
  $form['socialfeed_facebook_user_token'] = [
    '#type' => 'textfield',
    '#title' => t('Facebook User Token'),
    '#default_value' => variable_get('socialfeed_facebook_user_token'),
    '#size' => 60,
    '#maxlength' => 255,
    '#required' => TRUE,
  ];
  $form['socialfeed_facebook_no_feeds'] = [
    '#type' => 'textfield',
    '#title' => t('Number of Feeds'),
    '#default_value' => variable_get('socialfeed_facebook_no_feeds', 10),
    '#description' => t('Number of feeds you want to show from your Facebook Page.'),
    '#size' => 60,
    '#maxlength' => 60,
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
  ];
  $form['socialfeed_facebook_all_types'] = [
    '#type' => 'checkbox',
    '#title' => t('Show all post types'),
    '#default_value' => variable_get('socialfeed_facebook_all_types', TRUE),
  ];
  $form['socialfeed_facebook_post_type'] = [
    '#type' => 'select',
    '#title' => 'Select your post type(s) to show',
    '#default_value' => variable_get('socialfeed_facebook_post_type'),
    '#options' => [
      'link',
      'photo',
      'status',
      'video',
    ],
    '#states' => [
      'visible' => [
        ':input[name="socialfeed_facebook_all_types"]' => [
          'checked' => FALSE,
        ],
      ],
      'required' => [
        ':input[name="socialfeed_facebook_all_types"]' => [
          'checked' => FALSE,
        ],
      ],
    ],
  ];
  $form['socialfeed_facebook_display_pic'] = [
    '#type' => 'checkbox',
    '#title' => t('Show Post Picture'),
    '#default_value' => variable_get('socialfeed_facebook_display_pic', TRUE),
    '#states' => [
      'visible' => [
        ':input[name="socialfeed_facebook_post_type"]' => [
          'value' => 1,
        ],
      ],
    ],
  ];
  $form['socialfeed_facebook_display_video'] = [
    '#type' => 'checkbox',
    '#title' => t('Show Post Video'),
    '#default_value' => variable_get('socialfeed_facebook_display_video', TRUE),
    '#states' => [
      'visible' => [
        ':input[name="socialfeed_facebook_post_type"]' => [
          'value' => 3,
        ],
      ],
    ],
  ];
  $form['socialfeed_facebook_trim_length'] = [
    '#type' => 'textfield',
    '#title' => t('Trim Length'),
    '#default_value' => variable_get('socialfeed_facebook_trim_length', 120),
    '#size' => 60,
    '#maxlength' => 60,
    '#element_validate' => [
      'element_validate_integer_positive',
    ],
  ];
  $form['socialfeed_facebook_teaser_text'] = [
    '#type' => 'textfield',
    '#title' => t('Teaser Text'),
    '#default_value' => variable_get('socialfeed_facebook_teaser_text', 'Read More'),
    '#size' => 60,
    '#maxlength' => 60,
  ];
  $form['socialfeed_facebook_hashtag'] = [
    '#type' => 'checkbox',
    '#title' => t('Link to Hashtag'),
    '#default_value' => variable_get('socialfeed_facebook_hashtag', TRUE),
  ];
  $form['socialfeed_facebook_time_stamp'] = [
    '#type' => 'checkbox',
    '#title' => t('Show Date/Time'),
    '#default_value' => variable_get('socialfeed_facebook_time_stamp', FALSE),
  ];
  $form['socialfeed_facebook_time_format'] = [
    '#type' => 'textfield',
    '#title' => t('Date/Time format'),
    '#default_value' => variable_get('socialfeed_facebook_time_format', 'd-M-Y'),
    '#description' => t('You can check for PHP Date Formats <a href="@datetime" target="@blank">here</a>', [
      '@datetime' => 'http://php.net/manual/en/function.date.php',
      '@blank' => '_blank',
    ]),
    '#size' => 60,
    '#maxlength' => 100,
    '#states' => [
      'visible' => [
        ':input[name="socialfeed_facebook_time_stamp"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  return system_settings_form($form);
}