You are here

social_content.api.php in Social Content 7

Same filename and directory in other branches
  1. 7.2 social_content.api.php

Hooks provided by Social Content module

File

social_content.api.php
View source
<?php

/**
 * @file
 * Hooks provided by Social Content module
 */

/**
 * Define social content types.
 *
 * This hook enables modules to register their own social content imports.
 *
 * All social content imports inherit a set of common settings and options.
 * Additional settings and a settings form can be defined in this hook.
 *
 * $return $info
 *   An array of social content types, keyed by their name. With the
 *   following key values.
 *   - title (required): The human readable name of the import. Wrap in
 *     t()
 *   - content_type (required): The node content type that will be used
 *     for this import.
 *   - external_id_field_mapping (required): An array for mapping the
 *     id field name from the social content website. In the form of:
 *     array('remote_id_field' => 'local_id_field')
 *   - data_callback (required): Callback function for returning data.
 *   - post_callback: Callback function for processing each post (row).
 *   - settings_form: Callback function for modidying the settings form.
 *     All additional settings (defined in "additional settings" below)
 *     should be implemented in this form.
 *   - additional_settings: An array of additional settings.  In the
 *     form of array('variable name' => 'default value')
 *     All social content types receive the following variables:
 *       array(
 *         'limit' => 0, // (number of items per import, 0 for no limit)
 *         'auto_publish' => 1 // (whether posts should be published by default)
 *         'enabled' => 0, // (whether this import should run on cron)
 *       )
 */
function hook_social_content_info() {
  $info = array();
  $info['facebook'] = array(
    'title' => t('Facebook'),
    'content_type' => 'facebook',
    'external_id_field_mapping' => array(
      'id' => 'field_facebook_external_id',
    ),
    'data_callback' => 'social_content_facebook_data_callback',
    'post_callback' => 'social_content_facebook_post_callback',
    'settings_form' => 'social_content_facebook_settings_form',
    'additional_settings' => array(
      'user_id' => '',
      'graph_url' => 'https://graph.facebook.com',
      'access_token' => '',
      'min_resolution' => '',
    ),
  );
  return $info;
}

/**
 * Alter social content types.
 *
 * @param object $social_content_types
 *   An array of social content types.
 */
function hook_social_content_info_alter(&$social_content_types) {
}

/**
 * Alter social content types settings.
 *
 * @param array $settings
 *   The settings array.
 * @param object $social_content_type
 *   The social content type these settings are for.
 */
function hook_social_content_settings_alter(&$settings, $social_content_type) {
}

Functions

Namesort descending Description
hook_social_content_info Define social content types.
hook_social_content_info_alter Alter social content types.
hook_social_content_settings_alter Alter social content types settings.