From 087cca2ee62dc186b302bb2aec919e2a8bd85aaa Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Sat, 19 Dec 2015 23:15:33 -0500 Subject: [PATCH] Created a cg_core module with a settings form for homepage blocks --- sites/all/modules/Custom/cg_core/cg_core.info | 4 ++ .../modules/Custom/cg_core/cg_core.install | 16 ++++++ .../all/modules/Custom/cg_core/cg_core.module | 56 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 sites/all/modules/Custom/cg_core/cg_core.info create mode 100644 sites/all/modules/Custom/cg_core/cg_core.install create mode 100644 sites/all/modules/Custom/cg_core/cg_core.module diff --git a/sites/all/modules/Custom/cg_core/cg_core.info b/sites/all/modules/Custom/cg_core/cg_core.info new file mode 100644 index 0000000..27f0e0f --- /dev/null +++ b/sites/all/modules/Custom/cg_core/cg_core.info @@ -0,0 +1,4 @@ +name = cg_core +description = This module contains our custom code, as well as dependencies, ideally allowing us to 'rebuild the site' simply by enabling this module. It also contains a settings form so that the client can edit the homepage blocks. +core = 7.x +version = 7.x-1.x diff --git a/sites/all/modules/Custom/cg_core/cg_core.install b/sites/all/modules/Custom/cg_core/cg_core.install new file mode 100644 index 0000000..ac94b28 --- /dev/null +++ b/sites/all/modules/Custom/cg_core/cg_core.install @@ -0,0 +1,16 @@ + 'cg_theme', + //'zen' + ); + theme_enable($enable); + + foreach ($enable as $var => $theme) { + if (!is_numeric($var)) { + variable_set($var, $theme); + } + } +} diff --git a/sites/all/modules/Custom/cg_core/cg_core.module b/sites/all/modules/Custom/cg_core/cg_core.module new file mode 100644 index 0000000..e90b590 --- /dev/null +++ b/sites/all/modules/Custom/cg_core/cg_core.module @@ -0,0 +1,56 @@ + 'Homepage Settings', + // describe the page for the menu system. site visitors will not see this + 'description' => 'Staff configurable page with custom settings form.', + // function that is called when visiting the new path to generate the page's content + 'page callback' => 'cg_core_settings_form', + // permissions required to view page + 'access arguments' => array('administer site configuration'), + ); + return $items; +} + +/** + * Page callback: Custom settings form + */ +function cg_core_settings_form($form, &$form_state) { + $form['my_custom_blocks1'] = array( + '#type' => 'textarea', + '#title' => t('Block 1'), + '#default_value' => variable_get('mycustom_blocks', 'Welcome to our site'), + '#size' => 50, + '#maxlength' => 200, + '#description' => t('The content inside Block 1'), + '#required' => TRUE, + ); + + $form['my_custom_blocks2'] = array( + '#type' => 'textarea', + '#title' => t('Block 2'), + '#default_value' => variable_get('mycustom_blocks', 'Welcome to our site'), + '#size' => 50, + '#maxlength' => 200, + '#description' => t('The content inside Block 2'), + '#required' => TRUE, + ); + + $form['my_custom_blocks3'] = array( + '#type' => 'textarea', + '#title' => t('Block 3'), + '#default_value' => variable_get('my_custom_blocks', 'Welcome to our site'), + '#size' => 50, + '#maxlength' => 200, + '#description' => t('The content inside Block 3'), + '#required' => TRUE, + ); + + return system_settings_form($form); +} \ No newline at end of file