Commit d2fdbcab authored by maikelkoopman's avatar maikelkoopman
Browse files

#2926765 by maikelkoopman: describe changelog, update theme conditions for...

#2926765 by maikelkoopman: describe changelog, update theme conditions for showing form items, keep floating button rounded
parent bd79a227
### Release 1.8
We have added color configuration for the navbar and secondary navbar.
Also the way this is stored is now done via the color module (core package),
previously it was in improved_theme_settings - social package.
You need to update:
* __color.inc__ - add the new fields and default scheme
* __themename_settings.yml__ - prefix the new field with _color_
and replace hyphens with underscores. Hex values must
match exactly with you scheme in _color.inc_
* __brand.scss__ - This file is in the root of the
components folder. This file contains the exactly
and only the colors (as $vars is fine) you have defined
in the _color.inc_. Gulp will generate the css for you.
* __brand.css__ - this file should be generated via gulp.
Check that it only contains the hex color values you have
listed in the color file.
#### How does this color module work?
When you have implemented it correctly in your subtheme
the color module will take a copy of your __brand.css__ file
and replace the original hex values with the hex values that
are entered in the theme settings form. That copy is stored
in your public file directory. Now it can also be cached.
Each time a Site Manager saves the form, a new copy is generated.
### Release 1.7
The border radius properties have been split into
* Card border radius
* Form control border radius
* Button border radius
to allow for more flexibility between these elements.
You need to add the new options to your custom theme-settings.php
### v1.1.3 -- Apr 2017
* Changed styles for book navigation.
......
......@@ -19,97 +19,106 @@ function socialblue_form_system_theme_settings_alter(&$form, FormStateInterface
$theme = \Drupal::configFactory()->get('system.theme')->get('default');
// Check for the current active theme.
$active_theme = \Drupal::theme()->getActiveTheme()->getName();
// Check for the current default theme.
$system_theme_settings = \Drupal::configFactory()->get('system.theme')->get('default');
// If the default theme is either socialblue or socialsaas then extend
// the form in the appearance section.
if ($theme == 'socialblue' || $theme == 'socialsaas') {
$config = \Drupal::config($theme . '.settings');
$form['open_social_settings'] = [
'#type' => 'vertical_tabs',
'#title' => t('Opensocial settings'),
'#weight' => -50,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_color_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('Border radius'),
'#weight' => 20,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_font_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('Fonts'),
'#weight' => 10,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_color_settings']['card_radius'] = [
'#type' => 'number',
'#title' => t('Card border radius (px)'),
'#default_value' => $config->get('card_radius'),
'#description' => t('Define the roundness of cards corners.'),
];
$form['os_color_settings']['form_control_radius'] = [
'#type' => 'number',
'#title' => t('Form control border radius (px)'),
'#default_value' => $config->get('form_control_radius'),
'#description' => t('Define the roundness of the corners of form-controls, like <code>input</code>, <code>textarea</code> and <code>select</code>'),
];
$form['os_color_settings']['button_radius'] = [
'#type' => 'number',
'#title' => t('Button border radius (px)'),
'#default_value' => $config->get('button_radius'),
'#description' => t('Define the roundness of buttons corners.'),
];
$form['os_email_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('E-mail'),
'#weight' => 30,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_email_settings']['email_logo'] = [
'#type' => 'managed_file',
'#title' => t('Logo for e-mails'),
'#description' => t('Upload a logo which is shown in e-mail sent by the platform. This overrides the default logo that is also used in e-mails when no logo is provided here.'),
'#default_value' => $config->get('email_logo'),
'#upload_location' => 'public://',
'#upload_validators' => [
'file_validate_is_image' => [],
'file_validate_extensions' => ['gif png jpg jpeg'],
],
];
// Font tab.
$fonts = [];
if (\Drupal::service('module_handler')->moduleExists('social_font')) {
/** @var \Drupal\social_font\Entity\Font $font_entities */
foreach (Font::loadMultiple() as $font_entities) {
$fonts[$font_entities->id()] = $font_entities->get('name')->value;
if (array_key_exists('socialbase', \Drupal::service('theme.manager')->getActiveTheme()->getBaseThemes())) {
if ($active_theme == $system_theme_settings) {
$config = \Drupal::config($theme . '.settings');
$form['open_social_settings'] = [
'#type' => 'vertical_tabs',
'#title' => t('Opensocial settings'),
'#weight' => -50,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_color_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('Border radius'),
'#weight' => 20,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_font_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('Fonts'),
'#weight' => 10,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_color_settings']['card_radius'] = [
'#type' => 'number',
'#title' => t('Card border radius (px)'),
'#default_value' => $config->get('card_radius'),
'#description' => t('Define the roundness of cards corners.'),
];
$form['os_color_settings']['form_control_radius'] = [
'#type' => 'number',
'#title' => t('Form control border radius (px)'),
'#default_value' => $config->get('form_control_radius'),
'#description' => t('Define the roundness of the corners of form-controls, like <code>input</code>, <code>textarea</code> and <code>select</code>'),
];
$form['os_color_settings']['button_radius'] = [
'#type' => 'number',
'#title' => t('Button border radius (px)'),
'#default_value' => $config->get('button_radius'),
'#description' => t('Define the roundness of buttons corners.'),
];
$form['os_email_settings'] = [
'#type' => 'details',
'#group' => 'open_social_settings',
'#title' => t('E-mail'),
'#weight' => 30,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['os_email_settings']['email_logo'] = [
'#type' => 'managed_file',
'#title' => t('Logo for e-mails'),
'#description' => t('Upload a logo which is shown in e-mail sent by the platform. This overrides the default logo that is also used in e-mails when no logo is provided here.'),
'#default_value' => $config->get('email_logo'),
'#upload_location' => 'public://',
'#upload_validators' => [
'file_validate_is_image' => [],
'file_validate_extensions' => ['gif png jpg jpeg'],
],
];
// Font tab.
$fonts = [];
if (\Drupal::service('module_handler')->moduleExists('social_font')) {
/** @var \Drupal\social_font\Entity\Font $font_entities */
foreach (Font::loadMultiple() as $font_entities) {
$fonts[$font_entities->id()] = $font_entities->get('name')->value;
}
}
}
$form['os_font_settings']['font_primary'] = [
'#type' => 'select',
'#title' => t('Font'),
'#options' => $fonts,
'#default_value' => $config->get('font_primary'),
'#description' => t("The font family to use."),
];
$form['os_font_settings']['font_primary'] = [
'#type' => 'select',
'#title' => t('Font'),
'#options' => $fonts,
'#default_value' => $config->get('font_primary'),
'#description' => t("The font family to use."),
];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment