Skip to content
Snippets Groups Projects
Commit e30683cb authored by Viktor Holovachek's avatar Viktor Holovachek
Browse files

Issue #3432696 - Fix spell

parent 144fff00
No related branches found
No related tags found
1 merge request!7Issue #3432696 - Fix spell
Pipeline #125166 passed
{
"version": "0.2",
"language": "en",
"words": [
"Holovachek",
"Viktor",
"Mateescu",
"amateescu",
"Shudra"
],
"ignoreWords": [
"Blocktheme",
"blocktheme",
"blockthemes",
"isset",
"colspan",
"preprocess"
]
}
......@@ -36,17 +36,17 @@ information, see
1. Enable the module
2. Go to /admin/structure/block/blocktheme and add entries like:
customtemplate|My Custom Template
mysupertemplate|My SuperTemplate
custom_template|My Custom Template
my_super_template|My SuperTemplate
Where the first name is the machine-readable name of your template which may contain only
alphanumerical characters, -, or _ . The second name is the user-friendly name that appears
in the selectionbox on the block edit form.
in the select inbox on the block edit form.
3. Choose from either step 4. or 5.
4. Create twig files in your theme directory like: (Note: filenames must be preceded by block--blocktheme--)
block--blocktheme--customtemplate.html.twig
block--blocktheme--mysupertemplate.html.twig
block--blocktheme--custom-template.html.twig
block--blocktheme--my-super-template.html.twig
5. Alternatively use the extra provided variable $blocktheme to customize your
block.html.twig or block-*.html.twig files. The $blocktheme will typically be
......
......@@ -131,15 +131,15 @@ function blocktheme_form_block_admin_display_form_alter(&$form, FormStateInterfa
$config = \Drupal::config('blocktheme.settings')->get('show');
if (!empty($config)) {
$form['blocks']['#header'][] = t('Custom theme');
foreach ($form['blocks'] as $block => $parametrs) {
foreach ($form['blocks'] as $block => $parameters) {
if (isset($parametrs['message'])) {
if (isset($parameters['message'])) {
$form['blocks'][$block]['message']['#wrapper_attributes']['colspan']++;
}
if (isset($parametrs['title'])) {
if (isset($parameters['title'])) {
$form['blocks'][$block]['title']['#wrapper_attributes']['colspan']++;
}
if (isset($parametrs['weight'])) {
if (isset($parameters['weight'])) {
$template = blocktheme_get_theme_name($block);
$form['blocks'][$block][] = [
'#markup' => !empty($template) ? $template : '',
......@@ -245,11 +245,11 @@ function blocktheme_save($form, FormStateInterface $form_state) {
function blocktheme_get_blockthemes() {
$options = [];
$config = \Drupal::config('blocktheme.settings');
$blockthemes = $config->get('templates');
$block_themes = $config->get('templates');
$options[] = t('- None -');
if ($blockthemes) {
foreach ($blockthemes as $values) {
if ($block_themes) {
foreach ($block_themes as $values) {
$options[$values['name']] = $values['label'];
}
}
......@@ -293,8 +293,8 @@ function blocktheme_format_vars_admin($block_vars) {
* Get custom theme for a block.
*/
function blocktheme_get_theme($block) {
$blocktheme = blocktheme_get();
return !empty($blocktheme[$block]) ? $blocktheme[$block] : NULL;
$block_theme = blocktheme_get();
return !empty($block_theme[$block]) ? $block_theme[$block] : NULL;
}
/**
......
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