You are here

function fb_instant_articles_module_config_ads in Facebook Instant Articles 7.2

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

Generates Ads sub-section of Module Configuration section

1 call to fb_instant_articles_module_config_ads()
fb_instant_articles_settings in includes/admin.inc
Form constructor for Facebook Instant Articles Base settings form.

File

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

Code

function fb_instant_articles_module_config_ads($form) {
  $form['ads'] = array(
    '#type' => 'fieldset',
    '#title' => t('Ads'),
    '#collapsible' => TRUE,
    '#description' => t('Choose your preferred method for displaying ads in your Instant Articles and input the code in the boxes below. Learn more about your options for <a href="@ads_url">advertising in Instant Articles</a>', array(
      '@ads_url' => 'https://developers.facebook.com/docs/instant-articles/ads-analytics',
    )),
  );
  $form['ads']['fb_instant_articles_ad_type'] = array(
    '#type' => 'select',
    '#title' => t('Ad Type'),
    '#default_value' => variable_get('fb_instant_articles_ad_type', FB_INSTANT_ARTICLES_AD_TYPE_NONE),
    '#options' => fb_instant_articles_get_ad_types(),
    '#description' => t('<strong>Note:</strong> this module will automatically place the ads within your articles.'),
    '#attributes' => array(
      'class' => array(
        'ad-type',
      ),
    ),
  );
  $form['ads']['fb_instant_articles_ads_iframe_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Ad Source URL'),
    '#default_value' => variable_get('fb_instant_articles_ads_iframe_url'),
    '#description' => t('<strong>Note:</strong> Instant Articles only supports Direct Sold ads. No programmatic ad networks, other than Facebook\'s Audience Network, are permitted.'),
    '#size' => 80,
    '#element_validate' => array(
      'fb_instant_articles_validate_ad_source_url',
    ),
    '#states' => array(
      'visible' => array(
        '[name=fb_instant_articles_ad_type]' => array(
          'value' => FB_INSTANT_ARTICLES_AD_TYPE_SOURCE_URL,
        ),
      ),
    ),
  );
  $form['ads']['fb_instant_articles_ads_an_placement_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Audience Network Placement ID'),
    '#default_value' => variable_get('fb_instant_articles_ads_an_placement_id', ''),
    '#description' => t('Find your <a href="@placement_id_url" target="_blank">Placement ID</a> on your app\'s <a href="@audience_network_url" target="_blank">Audience Network Portal</a>.', array(
      '@placement_id_url' => '',
      '@audience_netowrk_url' => '',
    )),
    '#size' => 30,
    '#element_validate' => array(
      'fb_instant_articles_validate_an_placement_id',
    ),
    '#states' => array(
      'visible' => array(
        '[name=fb_instant_articles_ad_type]' => array(
          'value' => FB_INSTANT_ARTICLES_AD_TYPE_FBAN,
        ),
      ),
    ),
  );
  $form['ads']['fb_instant_articles_ads_embed_code'] = array(
    '#type' => 'textarea',
    '#title' => t('Ad Embed Code'),
    '#default_value' => variable_get('fb_instant_articles_ads_embed_code'),
    '#description' => t('Add code to be used for displayed ads in your Instant Articles.'),
    '#size' => 30,
    '#element_validate' => array(
      'fb_instant_articles_validate_ad_embed_code',
    ),
    '#states' => array(
      'visible' => array(
        '[name=fb_instant_articles_ad_type]' => array(
          'value' => FB_INSTANT_ARTICLES_AD_TYPE_EMBED_CODE,
        ),
      ),
    ),
  );
  $form['ads']['fb_instant_articles_ads_dimensions'] = array(
    '#type' => 'select',
    '#title' => t('Ad Dimensions'),
    '#options' => array(
      '300x250' => t('Large (300 x 250)'),
    ),
    '#default_value' => variable_get('fb_instant_articles_ads_dimensions'),
  );
  return $form;
}