PHP code example of cu-boulder / ucb_site_configuration
1. Go to this page and download the library: Download cu-boulder/ucb_site_configuration library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cu-boulder / ucb_site_configuration example snippets
$form['ucb_header_text_size'] = [
'#type' => 'select',
'#title' => $this->t('Site header text size'),
'#default_value' => theme_get_setting('ucb_header_text_size', $themeName) ?? 'medium',
'#options' => [
'small' => $this->t('Small'),
'medium' => $this->t('Medium'),
'large' => $this->t('Large')
],
'#description' => $this->t('Select the text size for the header at the top of the page.')
];
/**
* Adds theme setting for header text size.
*/
function ucb_site_configuration_update_95xx() {
// Ensures the default value of `medium` is set for the theme setting
\Drupal::configFactory()->getEditable(\Drupal::service('ucb_site_configuration')->getThemeName() . '.settings')->set('ucb_header_text_size', 'medium')->save();
// Exposes the theme setting on the "Appearance" adminstration form by updating the module configuration
$config = \Drupal::configFactory()->getEditable('ucb_site_configuration.configuration');
$editableThemeSettings = $config->get('editable_theme_settings');
$editableThemeSettings[] = 'ucb_header_text_size';
$config->set('editable_theme_settings', $editableThemeSettings)->save();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.