Skip to content
Snippets Groups Projects
Commit fb25e074 authored by Melissa Miller's avatar Melissa Miller
Browse files

Merge branch 'feature/theme-vars' into develop

Theme var documentation done. All other work is within theme.
parents a2308896 bc30b74f
No related branches found
No related tags found
No related merge requests found
# WCM8 Site Information
Adds additional site configuration fields such as contact info and social media links.
## Provided Variables
'prefix',
'admin_link',
'footer_text',
'address_1',
'address_2',
'city',
'state',
'zip',
'phone',
'fax',
'contact_email',
'twitter',
'facebook',
'linkedin',
'googleplus',
'youtube',
'instagram',
'photos'
## Theme usage
Add a preprocess function to your `THEMENAME.theme` file to make these variables available in your theme's twig templates.
Example code:
````
/**
* Implements hook_preprocess().
*/
function THEMENAME_preprocess(array &$variables, $hook) {
$siteinfo_config = \Drupal::config('wcm8_siteinfo.settings');
$siteinfo_vars = [
'prefix',
'admin_link',
'footer_text',
'address_1',
'address_2',
'city',
'state',
'zip',
'phone',
'fax',
'contact_email',
'twitter',
'facebook',
'linkedin',
'googleplus',
'youtube',
'instagram',
'photos'
];
foreach ($siteinfo_vars as $siteinfo_var) {
$variables[$siteinfo_var] = $siteinfo_config->get($siteinfo_var);
}
}
......@@ -68,16 +68,16 @@ class ModuleConfigurationForm extends ConfigFormBase {
$form['basic']['admin_link'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Admin Link'),
'#description' => $this->t('Check this box if you would like to display an admin login link in your site footer. It will be displayed discretely below the Footer Block.'),
'#description' => $this->t('Check this box if you would like to automatically display an admin login link in your site footer. It will be displayed below the Footer Block. If you don\'t want to add the link here you can add it elsewhere by creating a link to "/user/login".'),
'#default_value' => $config->get('admin_link'),
);
$form['basic']['footer_block'] = array(
$form['basic']['footer_text'] = array(
'#type' => 'text_format',
'#title' => $this->t('Footer Block'),
'#title' => $this->t('Footer Text'),
'#description' => $this->t('This content will be displayed in the footer below the contact info. It can contain links or other pertinent information. This is a good place for your ADA statement.'),
'#format' => 'basic_html',
'#default_value' => $config->get('footer_block.value'),
'#default_value' => $config->get('footer_text.value'),
);
// Contact Information tab
......@@ -145,7 +145,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
$form['social'] = array(
'#type' => 'details',
'#title' => $this->t('Social Networking'),
'#description' => $this->t('Linked icons will be displayed in the site footer for each account url that you provide. Leave blank any fields that you do not want to be displayed.'),
'#description' => $this->t('Linked icons will be displayed in the site footer for each social media account url that you provide. Leave blank any fields that you do not want to be displayed.'),
'#group' => 'siteinfo',
);
......@@ -223,7 +223,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
$this->config('wcm8_siteinfo.settings')
->set('prefix', $values['prefix'])
->set('admin_link', $values['admin_link'])
->set('footer_block', $values['footer_block'])
->set('footer_text', $values['footer_text'])
->set('address_1', $values['address_1'])
->set('address_2', $values['address_2'])
->set('city', $values['city'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment