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

change prefix to site_name_prefix

parent 4f4b18bf
No related merge requests found
......@@ -34,28 +34,28 @@ class ModuleConfigurationForm extends ConfigFormBase {
$config = $this->config('wcm8_siteinfo.settings');
$site_config = $this->config('system.site');
$site_name = $site_config->get('name');
$form['siteinfo'] = array(
'#type' => 'vertical_tabs',
'#default_tab' => 'edit-basic',
);
// Basic Information tab
$form['basic'] = array(
'#type' => 'details',
'#title' => $this->t('Basic Information'),
'#group' => 'siteinfo',
);
$form['basic']['prefix'] = array(
$form['basic']['site_name_prefix'] = array(
'#type' => 'textfield',
'#title' => $this->t('Site Name Prefix'),
'#description' => $this->t('The prefix for your site name - for example, <i>Department of</i> ... '),
'#size' => '60',
'#maxlength' => '60',
'#default_value' => $config->get('prefix'),
'#default_value' => $config->get('site_name_prefix'),
);
$form['basic']['site_name'] = array(
'#type' => 'textfield',
'#title' => $this->t('Site Name'),
......@@ -64,14 +64,14 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '75',
'#default_value' => $site_name,
);
$form['basic']['admin_link'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Admin Link'),
'#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_text'] = array(
'#type' => 'text_format',
'#title' => $this->t('Footer Text'),
......@@ -94,53 +94,53 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#description' => $this->t('First line of address. Room number and building if on campus.'),
'#default_value' => $config->get('address_1'),
);
$form['contact']['address_2'] = array(
'#type' => 'textfield',
'#title' => $this->t('Address Line 2'),
'#description' => $this->t('Second line of address. Street address if on campus.'),
'#default_value' => $config->get('address_2'),
);
$form['contact']['city'] = array(
'#type' => 'textfield',
'#title' => $this->t('City'),
'#default_value' => $config->get('city'),
);
$form['contact']['state'] = array(
'#type' => 'textfield',
'#title' => $this->t('State'),
'#default_value' => $config->get('state'),
);
$form['contact']['zip'] = array(
'#type' => 'textfield',
'#title' => $this->t('Zip Code'),
'#default_value' => $config->get('zip'),
);
$form['contact']['phone'] = array(
'#type' => 'tel',
'#title' => $this->t('Phone'),
'#description' => $this->t('Main contact phone number for your site.'),
'#default_value' => $config->get('phone'),
);
$form['contact']['fax'] = array(
'#type' => 'tel',
'#title' => $this->t('Fax'),
'#description' => $this->t('Fax number, if applicable.'),
'#default_value' => $config->get('fax'),
);
$form['contact']['contact_email'] = array(
'#type' => 'email',
'#title' => $this->t('Email'),
'#description' => $this->t('Main contact email for your site.'),
'#default_value' => $config->get('contact_email'),
);
// Social Networking tab
$form['social'] = array(
'#type' => 'details',
......@@ -148,7 +148,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#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',
);
$form['social']['twitter'] = array(
'#type' => 'textfield',
'#title' => $this->t('Twitter'),
......@@ -157,7 +157,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('twitter'),
);
$form['social']['facebook'] = array(
'#type' => 'textfield',
'#title' => $this->t('Facebook'),
......@@ -166,7 +166,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('facebook'),
);
$form['social']['linkedin'] = array(
'#type' => 'textfield',
'#title' => $this->t('LinkedIn'),
......@@ -175,7 +175,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('linkedin'),
);
$form['social']['googleplus'] = array(
'#type' => 'textfield',
'#title' => $this->t('Google+'),
......@@ -184,7 +184,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('googleplus'),
);
$form['social']['youtube'] = array(
'#type' => 'textfield',
'#title' => $this->t('YouTube'),
......@@ -193,7 +193,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('youtube'),
);
$form['social']['instagram'] = array(
'#type' => 'textfield',
'#title' => $this->t('Instagram'),
......@@ -202,7 +202,7 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#maxlength' => '150',
'#default_value' => $config->get('instagram'),
);
$form['social']['photos'] = array(
'#type' => 'textfield',
'#title' => $this->t('Photos'),
......@@ -220,10 +220,10 @@ class ModuleConfigurationForm extends ConfigFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
//set config values unique to this module
$this->config('wcm8_siteinfo.settings')
->set('prefix', $values['prefix'])
->set('site_name_prefix', $values['site_name_prefix'])
->set('admin_link', $values['admin_link'])
->set('footer_text', $values['footer_text'])
->set('address_1', $values['address_1'])
......@@ -242,12 +242,12 @@ class ModuleConfigurationForm extends ConfigFormBase {
->set('instagram', $values['instagram'])
->set('photos', $values['photos'])
->save();
//set site name value back to system.site
$this->configFactory->getEditable('system.site')
->set('name', $values['site_name'])
->save();
parent::submitForm($form, $form_state);
}
}
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