FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,14 @@
name = Variable example
description = An example module showing how to use the Variable API and providing some variables.
dependencies[] = variable
dependencies[] = variable_store
package = Example modules
core = 7.x
files[] = variable_example.variable.inc
; Information added by drupal.org packaging script on 2013-08-09
version = "7.x-2.3"
core = "7.x"
project = "variable"
datestamp = "1376034993"

View File

@@ -0,0 +1,81 @@
<?php
/**
* Variable example.
*/
/**
* Implements hook_variable_realm_info()
*/
function variable_example_variable_realm_info() {
$realm['example'] = array(
'title' => t('Example'),
'weight' => 10,
'store class' => 'VariableStoreRealmStore',
'keys' => array(
'first' => t('First example'),
'second' => t('Second example'),
),
);
return $realm;
}
/**
* Implements hook_menu().
*/
function variable_example_menu() {
$items['admin/config/system/variable_example'] = array(
'title' => 'Variable example',
'description' => 'Example of auto generated settings form.',
'page callback' => 'drupal_get_form',
'page arguments' => array('variable_group_form', 'variable_example'),
'access arguments' => array('administer site configuration'),
);
$items['variable/example'] = array(
'title' => 'Variable example',
'description' => 'List some variables.',
'page callback' => 'variable_example_page_list',
'access arguments' => array('administer site configuration'),
);
$items['variable/realm/%/%'] = array(
'title' => 'Variable example realm',
'description' => 'Example of variable realms.',
'page callback' => 'variable_example_page_realm',
'page arguments' => array(2, 3),
'access arguments' => array('administer site configuration'),
);
return $items;
}
/**
* Variable example realm page.
*
* Will switch to given realm and display variables.
*/
function variable_example_page_list() {
variable_include();
$list = variable_list_group('site_information') + variable_list_group('variable_example');
foreach ($list as $name => $variable) {
$build[$name] = array(
'#type' => 'item',
'#title' => $variable['title'],
'#markup' => variable_format_value($variable),
);
}
return $build;
}
/**
* Variable example realm page.
*
* Will switch to given realm and display variables.
*/
function variable_example_page_realm($realm, $key) {
// Initialize realm from variable store.
$variables = variable_store($realm, $key);
// Set at least one variable for the realm
$variables += array('site_name' => 'Variable example realm');
variable_realm_add($realm, $key, $variables);
variable_realm_switch($realm, $key);
return variable_example_page_list();
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* @file
* Variable API module. Definition for some xample variables
*/
/**
* Implements hook_variable_info().
*/
function variable_example_variable_info($options) {
// Simple text
$variables['variable_example_text'] = array(
'type' => 'text',
'title' => t('Simple text', array(), $options),
'default' => 'Example text.',
'description' => t('Example of text variable.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
// Simple number, demonstrates validate callback.
$variables['variable_example_number'] = array(
'type' => 'number',
'title' => t('Number', array(), $options),
'default' => 0,
'description' => t('Example of numeric variable.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
// Text with format
$variables['variable_example_text_format'] = array(
'type' => 'text_format',
'title' => t('Text format', array(), $options),
// The default value may be a string (default format will be added) or
// an array with 'format' (format name) and 'value' (string) elements
'default' => 'Example text with default format',
'description' => t('Example of text variable with text format.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
// Text with format
$variables['variable_example_mail_[mail_part]'] = array(
'type' => 'mail_text',
'title' => t('Example mail', array(), $options),
'default' => array(
'subject' => t('Example mail subject', array(), $options),
'body' => t('Example mail body.', array(), $options),
),
'description' => t('Example mail variable with subject and body.', array(), $options),
'required' => TRUE,
'group' => 'variable_example',
);
return $variables;
}
/**
* Implements hook_variable_group_info().
*/
function variable_example_variable_group_info() {
$groups['variable_example'] = array(
'title' => t('Examples'),
'description' => t('Variable examples of different types.'),
'access' => 'administer site configuration',
'path' => array('admin/config/system/variable/example'),
);
return $groups;
}