When trying to set up a settings form for a theme (using HOOK_form_system_theme_settings_alter()
in a theme-settings.php
file), I very often find myself doing something like this:
function MYTHEME_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL) {
$my_setting = theme_get_setting('my_setting');
$form['my_setting'] = array(
'#type' => 'checkbox',
'#title' => t('Some setting'),
'#default_value' => isset($my_setting) ? $my_setting : TRUE,
);
}
I would like to be able to do the following instead:
function MYTHEME_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL) {
$form['my_setting'] = array(
'#type' => 'checkbox',
'#title' => t('Some setting'),
'#default_value' => theme_get_setting('my_setting', 'MYTHEME', TRUE),
);
}
In other words, change the function to include a 3rd, optional $default
parameter so that it is theme_get_setting($setting_name, $theme = NULL, $default = NULL)
.
Similarly, I would like to be able to do that with config_get()
, so change it to this:
config_get($config_file, $option = NULL, $default = NULL)
.
Recent comments
In page.tpl.php you can get the current path and add it to the class array $classes[] = 'path-' . str_replace('/', '', $_SERVER['REQUEST_URI']); You will get an original class for each page....
Insert custom class into body tag
https://www.drupal.org/project/views/issues/1266388 shows that this is an architectural issue, and requires another 2 hooks being adjusted. It would be really nice to add comments/notes to...
node access
Hmmm, from D7 ancient tomes: from https://drupal.stackexchange.com/questions/7056/limit-which-roles-can-view-a-node-basing-on-its-content-type yet https://docs.backdropcms.org/api/...
node access