HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux newsites.squeezer-software.com 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/sites/orpis/sites/all/modules/contrib/variable/variable_example/variable_example.module
<?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();
}