Skip to content

Commit c2813d4

Browse files
authored
Add verification of Branding version for logo feature (#19)
1 parent d762a1f commit c2813d4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

inc/config.class.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ public static function showConfigForm($item)
152152
$config->showFormHeader();
153153

154154
$is_branding_active = Plugin::isPluginActive('branding');
155+
$is_branding_compatible = false;
156+
157+
if ($is_branding_active) {
158+
$branding_info = Plugin::getInfo('branding');
159+
if (isset($branding_info['version']) && version_compare($branding_info['version'], '3.0.0', '>=')) {
160+
$is_branding_compatible = true;
161+
}
162+
}
155163

156164
$options = [];
157165
foreach ($PDF_DEVICES as $option => $value) {
@@ -163,8 +171,8 @@ public static function showConfigForm($item)
163171
[
164172
'currency_options' => $options,
165173
'selected_currency' => $config->fields['currency'],
166-
'is_branding_active' => $is_branding_active,
167-
'use_branding_logo' => (!empty($config->fields['use_branding_logo']) && $is_branding_active),
174+
'is_branding_active' => $is_branding_active && $is_branding_compatible,
175+
'use_branding_logo' => (!empty($config->fields['use_branding_logo']) && $is_branding_active && $is_branding_compatible),
168176
'add_text' => $config->fields['add_text'],
169177
],
170178
);

templates/config.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{% else %}
6363
<label class="form-switch mt-1" style="padding-left: 1rem;"
6464
data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-trigger="hover"
65-
title="{{ __('The Branding plugin is disabled or non-existent', 'pdf') }}">
65+
title="{{ __('The Branding plugin is either disabled, missing, or its version is below 3.0.0.', 'pdf') }}">
6666
<input type="checkbox" class="form-check-input ms-0 me-1 mt-0" disabled />
6767
</label>
6868
{% endif %}

0 commit comments

Comments
 (0)