Created
March 29, 2014 10:26
-
-
Save xxronis/9852015 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_menu(). | |
*/ | |
function module_menu() { | |
$items = array(); | |
$items['admin/config/site/module'] = array( | |
'title' => 'Module configuration', | |
'description' => 'Module settings form.', | |
'page callback' => 'drupal_get_form', | |
'page arguments' => array('variable_module_form', 'module'), | |
'access arguments' => array('administer site configuration'), | |
'type' => MENU_NORMAL_ITEM, | |
'file' => 'module.variable.inc', | |
); | |
return $items; | |
} | |
#################### | |
/** | |
* Implements hook_variable_info(). | |
*/ | |
function module_variable_info($options) { | |
$variables['variable_name'] = array( | |
'type' => 'string', | |
'title' => t('Variable name', array(), $options), | |
'description' => t( | |
'description', array(), $options), | |
'default' => '0', | |
'access' => 'administer openbet configuration', | |
'required' => TRUE, | |
'validate callback' => 'validate_callback', | |
); | |
} | |
/* | |
* Implements hook_variable_settings_form_alter(). | |
*/ | |
function module_variable_settings_form_alter(&$form, &$form_state, $form_id) { | |
if (isset($form['#variable_module_form']) && $form['#variable_module_form'] == 'module') { | |
$form['#submit'][] = '__callback'; | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment