You are here

function fb_instant_articles_settings in Facebook Instant Articles 7.2

Same name and namespace in other branches
  1. 7 includes/admin.inc \fb_instant_articles_settings()

Form constructor for Facebook Instant Articles Base settings form.

1 string reference to 'fb_instant_articles_settings'
fb_instant_articles_menu in ./fb_instant_articles.module
Implements hook_menu().

File

includes/admin.inc, line 11
Settings for Facebook Instant Articles Base module.

Code

function fb_instant_articles_settings() {

  // Initialize this module's settings form
  $form = array();

  // Add the page id configuration.
  $args = array(
    '@claim_url' => 'https://developers.facebook.com/docs/instant-articles/claim-url',
  );
  $form['fb_instant_articles_page_id'] = array(
    '#title' => t('Facebook Page ID'),
    '#type' => 'textfield',
    '#default_value' => variable_get('fb_instant_articles_page_id'),
    '#description' => t('In order to designate the domain that will host your
      articles you must add your Facebook page ID to a metatag in the HEAD tag
      of your HTML page. Entering your Facebook Page ID here will add the
      metatag automatically. See <a href="@claim_url">Claiming your URL
      </a>.', $args),
  );

  // Add the style configuration.
  $form['fb_instant_articles_style'] = array(
    '#type' => 'textfield',
    '#title' => t('Article Style'),
    '#default_value' => variable_get('fb_instant_articles_style', 'default'),
    '#size' => 30,
    '#element_validate' => array(
      'fb_instant_articles_validate_style',
    ),
    '#description' => t('Assign your Instant Articles a custom style. To begin, customize a template using the <a href="@style_url" target="_blank">Style Editor</a>. Next, input the name of the style below. <strong>Note</strong>: if this field is left blank, the module will enable the “Default” style. Learn more about Instant Articles style options in the <a href="@design_url" target="_blank">Design Guide</a>.', array(
      '@style_url' => '',
      '@design_url' => 'https://developers.facebook.com/docs/instant-articles/guides/design',
    )),
  );

  // Add the Ads sub-section.
  $form = fb_instant_articles_module_config_ads($form);

  // Add the Analytics sub-section.
  $form = fb_instant_articles_module_config_analytics($form);

  // Add the Debug Configuration.
  $form['fb_instant_articles_enable_logging'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable FB Instant Articles SDK logging?'),
    '#default_value' => variable_get('fb_instant_articles_enable_logging'),
    '#description' => t('Sends Facebook Instant Articles SDK logging messages to Drupal watchdog.'),
  );

  // Add the Canonical URL override.
  $form['fb_instant_articles_canonical_url_override'] = array(
    '#type' => 'textfield',
    '#title' => t('Canonical URL override'),
    '#default_value' => variable_get('fb_instant_articles_canonical_url_override', ''),
    '#description' => t('If you need to override the base url portion of the canonical URL, you can do so here. This may be helpful for development domains or necessary if admin users perform tasks that trigger Facebook requests from alternate domains. This URL should not include a trailing slash (e.g. http://drupal.org).'),
  );
  $form = system_settings_form($form);
  return $form;
}