Skip to content

Conversation

@live627
Copy link
Contributor

@live627 live627 commented Dec 29, 2024

We have several templates (layers) that just call others. This commit introduces Utils::$context['sub_templates'] which is a simple list of templates to call

Bonus: If a template name is array, the second element shall be parametres to pass to the function. Similar structure to $post_errors in the Post action.

$before = array_slice(Utils::$context['template_layers'], 0, $position + 1);
$after = array_slice(Utils::$context['template_layers'], $position + 1);
Utils::$context['template_layers'] = array_merge($before, ['maint_warning'], $after);
array_splice(Utils::$context['template_layers'], $position + 1, 0, ['maint_warning']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, what is maint_warning? Maybe main_warning, main, or warning?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintenance warning.

Copy link
Member

@Sesquipedalian Sesquipedalian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from indentation issue, LGTM.

Comment on lines 2212 to 2220
'thumbnail' => file_exists($theme_data['theme_dir'] . '/images/thumbnail_' . $variant . '.png') ? $theme_data['images_url'] . '/thumbnail_' . $variant . '.png' : (file_exists($theme_data['theme_dir'] . '/images/thumbnail.png') ? $theme_data['images_url'] . '/thumbnail.png' : ''),
];
}

Utils::$context['available_themes'][$id_theme]['selected_variant'] = $_GET['vrt'] ?? (!empty($variant_preferences[$id_theme]) ? $variant_preferences[$id_theme] : (!empty(self::$current->settings['default_variant']) ? self::$current->settings['default_variant'] : self::$current->settings['theme_variants'][0]));
Utils::$context['available_themes'][$id_theme]['selected_variant'] = $_GET['vrt'] ?? (!empty($variant_preferences[$id_theme]) ? $variant_preferences[$id_theme] : (!empty(self::$current->settings['default_variant']) ? self::$current->settings['default_variant'] : self::$current->settings['theme_variants'][0]));

if (!isset(Utils::$context['available_themes'][$id_theme]['variants'][Utils::$context['available_themes'][$id_theme]['selected_variant']]['thumbnail'])) {
Utils::$context['available_themes'][$id_theme]['selected_variant'] = self::$current->settings['theme_variants'][0];
}
if (!isset(Utils::$context['available_themes'][$id_theme]['variants'][Utils::$context['available_themes'][$id_theme]['selected_variant']]['thumbnail'])) {
Utils::$context['available_themes'][$id_theme]['selected_variant'] = self::$current->settings['theme_variants'][0];
}
Copy link
Member

@Sesquipedalian Sesquipedalian Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These indentation changes appear to be a mistake.

EDIT: for some reason GitHub isn't showing all the lines I commented on, but this comment was meant to include lines -2195 to +2220 (meaning, the indentation change before 'thumbnail' => ... and all following lines.)

@Sesquipedalian
Copy link
Member

The latest commit brought back the weird indentation again

@live627
Copy link
Contributor Author

live627 commented Dec 31, 2024 via email

@Sesquipedalian Sesquipedalian merged commit f391792 into SimpleMachines:release-3.0 Jan 1, 2025
6 checks passed
@live627 live627 deleted the feat/tpl branch January 3, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants