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

Merge branch 'feature/separate-form' into develop

I have decided to go with a separate form for siteinfo instead of altering core form.
parents dac85c3a 21a6af95
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,8 @@ class ModuleConfigurationForm extends ConfigFormBase {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('wcm8_siteinfo.settings');
$site_config = $this->config('system.site');
$site_name = $site_config->get('name');
$form['siteinfo'] = array(
'#type' => 'vertical_tabs',
......@@ -56,19 +58,36 @@ class ModuleConfigurationForm extends ConfigFormBase {
$form['basic']['site_name'] = array(
'#type' => 'textfield',
'#title' => $this->t('Site Name'),
'#description' => $this->t('Main name for the site - it should be your college, department or organization name.'),
'#description' => $this->t('READ ONLY for now until this app is done. Main name for the site - it should be your college, department or organization name.'),
'#size' => '60',
'#maxlength' => '75',
'#default_value' => $this->config('system.site')->get('name'),
'#default_value' => $site_name,
'#attributes' => array('readonly' => 'readonly'),
);
$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.'),
'#default_value' => $config->get('admin_link'),
);
$form['basic']['footer_block'] = array(
'#type' => 'text_format',
'#title' => $this->t('Footer Block'),
'#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'),
);
// Contact Information tab
$form['contact'] = array(
'#type' => 'details',
'#title' => $this->t('Contact Information'),
'#description' => $this->t('Contact information will be displayed below the Ohio State wordmark in the site footer. Leave blank any fields that you do not want to be displayed.'),
'#group' => 'siteinfo',
);
$form['contact']['address_1'] = array(
'#type' => 'textfield',
'#title' => $this->t('Address Line 1'),
......@@ -115,25 +134,83 @@ class ModuleConfigurationForm extends ConfigFormBase {
'#default_value' => $config->get('fax'),
);
$form['contact']['email'] = array(
$form['contact']['contact_email'] = array(
'#type' => 'email',
'#title' => $this->t('Email'),
'#description' => $this->t('Main contact email for your site.'),
'#default_value' => $config->get('email'),
'#default_value' => $config->get('contact_email'),
);
// Social Networking tab
$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.'),
'#group' => 'siteinfo',
);
$form['social']['twitter'] = array(
'#type' => 'textfield',
'#title' => $this->t('Twitter'),
'#description' => t('Enter the URL to your Twitter account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('twitter'),
);
$form['social']['facebook'] = array(
'#type' => 'textfield',
'#title' => $this->t('Facebook'),
'#description' => t('Enter the URL to your Facebook account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('facebook'),
);
$form['social']['linkedin'] = array(
'#type' => 'textfield',
'#title' => $this->t('LinkedIn'),
'#description' => t('Enter the URL to your LinkedIn account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('linkedin'),
);
$form['social']['googleplus'] = array(
'#type' => 'textfield',
'#title' => $this->t('Google+'),
'#description' => t('Enter the URL to your Google+ account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('googleplus'),
);
$form['social']['youtube'] = array(
'#type' => 'textfield',
'#title' => $this->t('YouTube'),
'#description' => t('Enter the URL to your YouTube account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('youtube'),
);
$form['social']['instagram'] = array(
'#type' => 'textfield',
'#title' => $this->t('Instagram'),
'#description' => t('Enter the URL to your Instagram account.'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('instagram'),
);
$form['social']['photos'] = array(
'#type' => 'textfield',
'#title' => $this->t('Photos'),
'#description' => t('Enter the URL to your photo sharing account (ex. Flickr, SmugMug, Picasa, etc...).'),
'#size' => '70',
'#maxlength' => '150',
'#default_value' => $config->get('photos'),
);
return parent::buildForm($form, $form_state);
}
......@@ -145,6 +222,8 @@ class ModuleConfigurationForm extends ConfigFormBase {
$values = $form_state->getValues();
$this->config('wcm8_siteinfo.settings')
->set('prefix', $values['prefix'])
->set('admin_link', $values['admin_link'])
->set('footer_block', $values['footer_block'])
->set('address_1', $values['address_1'])
->set('address_2', $values['address_2'])
->set('city', $values['city'])
......@@ -152,8 +231,14 @@ class ModuleConfigurationForm extends ConfigFormBase {
->set('zip', $values['zip'])
->set('phone', $values['phone'])
->set('fax', $values['fax'])
->set('email', $values['email'])
->set('email', $values['contact_email'])
->set('twitter', $values['twitter'])
->set('facebook', $values['facebook'])
->set('linkedin', $values['linkedin'])
->set('googleplus', $values['googleplus'])
->set('youtube', $values['youtube'])
->set('instagram', $values['instagram'])
->set('photos', $values['photos'])
->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