You are here

fb_instant_articles.install in Facebook Instant Articles 7

Install and update functions for Facebook Instant Articles Base module.

File

fb_instant_articles.install
View source
<?php

/**
 * @file
 * Install and update functions for Facebook Instant Articles Base module.
 */

/**
 * Implements hook_uninstall().
 */
function fb_instant_articles_uninstall() {
  variable_del('fb_instant_articles_page_id');
  variable_del('fb_instant_articles_style');
  variable_del('fb_instant_articles_ad_type');
  variable_del('fb_instant_articles_ads_iframe_url');
  variable_del('fb_instant_articles_ads_an_placement_id');
  variable_del('fb_instant_articles_ads_dimensions');
  variable_del('fb_instant_articles_ads_embed_code');
  variable_del('fb_instant_articles_analytics_embed_code');
  variable_del('fb_instant_articles_enable_logging');
  variable_del('fb_instant_articles_bypass_composer_manager');
}

/**
 * Implements hook_requirements().
 */
function fb_instant_articles_requirements() {
  $requirements = array();
  $t = get_t();
  $bypass_composer_manager = variable_get('fb_instant_articles_bypass_composer_manager');
  $composer_manager_enabled = module_exists('composer_manager');
  if (!($bypass_composer_manager || $composer_manager_enabled)) {
    $string = 'The Facebook Instant Articles module requires the
 facebook-instant-articles-sdk-php library, and Composer autoloading. The
 easiest way to set this up is to enable the <a href="@composer-manager">
 Composer manager</a> module, which autoloads classes needed for the Facebook
 Instant Articles SDK, and downloads the SDK automatically when you enable the
 base module. Composer manager is not a literal dependency so that developers
 with custom Composer workflows can choose to manage dependencies and
 autoloading themselves (if this is the case you will need to include
 Composer\'s autoload file somewhere in your code).';
    $args = array(
      '@composer-manager' => 'https://drupal.org/project/composer_manager',
    );
    $requirements['autoload']['description'] = $t($string, $args);
    $requirements['autoload']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}