You are here

social_content.variable.inc in Social Content 7

Same filename and directory in other branches
  1. 7.2 social_content.variable.inc

Social content variable file

File

social_content.variable.inc
View source
<?php

/**
 * @file
 * Social content variable file
 */

/**
 * Implements hook_variable_group_info().
 */
function social_content_variable_group_info() {
  $groups['social_content'] = array(
    'title' => t('Social Content'),
    'description' => t('Social Content settings'),
    'access' => 'administer site configuration',
  );
  return $groups;
}

/**
 * Implements hook_variable_info().
 */
function social_content_variable_info($options) {
  $types = social_content_get_types();
  foreach ($types as $type) {

    // TODO: Apparently it is possible to pass tokens into the variable name
    // (see variable.api.php hook_variable_info())
    // But I was unable to get this working.
    // NOTE: Using type => array means that all variables
    // get type => 'textfield'.  If we ever want to use different types
    // we will need to declare each variable separatley.
    $admin_link = l(t('!social_content_type settings form', array(
      '!social_content_type' => $type['title'],
    )), 'admin/config/services/social-content/' . $type['name']);
    $variable['social_content_' . $type['name']] = array(
      'title' => t('Social Content: !social_content_type', array(
        '!social_content_type' => $type['title'],
      )),
      'type' => 'array',
      'group' => 'social_content',
      'localize' => TRUE,
      'description' => t('Please configure these settings through the !social_settings_form.', array(
        '!social_settings_form' => $admin_link,
      )),
    );
  }
  return $variable;
}