Social links and icons are now editables
This commit is contained in:
parent
ab55a69459
commit
7baa51d5a8
8 changed files with 89 additions and 33 deletions
|
@ -1155,7 +1155,7 @@ function system_site_information_settings() {
|
|||
$form['site_name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Name'),
|
||||
'#default_value' => variable_get('site_name', 'Drupal'),
|
||||
'#default_value' => variable_get('site_name', 'SuiteDesk'),
|
||||
'#description' => t('The name of this website.'),
|
||||
'#required' => TRUE
|
||||
);
|
||||
|
@ -1178,6 +1178,36 @@ function system_site_information_settings() {
|
|||
'#default_value' => variable_get('site_mission', ''),
|
||||
'#description' => t("Your site's mission or focus statement (often prominently displayed on the front page).")
|
||||
);
|
||||
$form['site_twitter'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Twitter URL'),
|
||||
'#default_value' => variable_get('site_twitter', ''),
|
||||
'#description' => t('URL address of your Twitter account.')
|
||||
);
|
||||
$form['site_facebook'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Facebook URL'),
|
||||
'#default_value' => variable_get('site_facebook', ''),
|
||||
'#description' => t('URL address of your Facebook page.')
|
||||
);
|
||||
$form['site_linkedin'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('LinkedIn URL'),
|
||||
'#default_value' => variable_get('site_linkedin', ''),
|
||||
'#description' => t('URL address of your LinkedIn account.')
|
||||
);
|
||||
$form['site_contact'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Web contact URL'),
|
||||
'#default_value' => variable_get('site_contact', ''),
|
||||
'#description' => t('URL address of your contact page.')
|
||||
);
|
||||
$form['site_rss'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Feed URL'),
|
||||
'#default_value' => variable_get('site_rss', ''),
|
||||
'#description' => t('Source feed of your main website.')
|
||||
);
|
||||
$form['site_footer'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Footer message'),
|
||||
|
@ -1213,6 +1243,13 @@ function system_site_information_settings_validate($form, &$form_state) {
|
|||
if ($error = user_validate_mail($form_state['values']['site_mail'])) {
|
||||
form_set_error('site_mail', $error);
|
||||
}
|
||||
// Validate social links.
|
||||
unset($_SESSION['socialmenu']);
|
||||
_system_site_information_validate_url($form_state, 'site_twitter');
|
||||
_system_site_information_validate_url($form_state, 'site_facebook');
|
||||
_system_site_information_validate_url($form_state, 'site_linkedin');
|
||||
_system_site_information_validate_url($form_state, 'site_contact');
|
||||
_system_site_information_validate_url($form_state, 'site_rss');
|
||||
// Validate front page path.
|
||||
$item = array('link_path' => $form_state['values']['site_frontpage']);
|
||||
$normal_path = drupal_get_normal_path($item['link_path']);
|
||||
|
@ -1225,6 +1262,12 @@ function system_site_information_settings_validate($form, &$form_state) {
|
|||
}
|
||||
}
|
||||
|
||||
function _system_site_information_validate_url(&$form_state, $site_field) {
|
||||
if (!empty($form_state['values'][$site_field]) && !valid_url($form_state['values'][$site_field], TRUE)) {
|
||||
form_set_error($site_field, t("The path '@path' is not valid.", array('@path' => $form_state['values'][$site_field])));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Form builder; Configure error reporting settings.
|
||||
*
|
||||
|
|
Reference in a new issue