Skip to content

Commit c215b7a

Browse files
committed
fix : fix some bugs and modified the plugins settings page
1 parent 8f94056 commit c215b7a

File tree

2 files changed

+9
-29
lines changed

2 files changed

+9
-29
lines changed

plugins/system/opengraph/opengraph.xml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,15 @@
2929
</languages>
3030
<config>
3131
<fields name="params">
32-
<fieldset name="global_og_settings"
33-
label="PLG_SYSTEM_OPENGRAPH_GLOBAL_OG_SETTINGS"
34-
description="PLG_SYSTEM_OPENGRAPH_GLOBAL_DESC">
32+
<fieldset name="basic">
3533
<field name="enable_og_generation"
3634
type="radio"
37-
class="btn-group btn-group-yesno"
35+
layout="joomla.form.field.radio.switcher"
3836
default="1"
3937
label="PLG_SYSTEM_OPENGRAPH_ENABLE_OG_GENERATION"
4038
description="PLG_SYSTEM_OPENGRAPH_ENABLE_OG_GENERATION_DESC">
41-
<option value="0">JNO</option>
42-
<option value="1">JYES</option>
39+
<option value="0">JDISABLED</option>
40+
<option value="1">JENABLED</option>
4341
</field>
4442
<field name="fb_app_id"
4543
type="text"
@@ -67,24 +65,6 @@
6765
min="50"
6866
max="200" />
6967
</fieldset>
70-
<fieldset name="overview_help"
71-
label="PLG_SYSTEM_OPENGRAPH_OVERVIEW">
72-
<field name="about_note"
73-
type="note"
74-
class="alert alert-info"
75-
label="PLG_SYSTEM_OPENGRAPH_FEATURES_LABEL"
76-
description="PLG_SYSTEM_OPENGRAPH_FEATURES_DESC" />
77-
<field name="quickstart_note"
78-
type="note"
79-
class="alert alert-primary"
80-
label="PLG_SYSTEM_OPENGRAPH_QUICKSTART_LABEL"
81-
description="PLG_SYSTEM_OPENGRAPH_QUICKSTART_DESC" />
82-
<field name="tips_note"
83-
type="note"
84-
class="alert alert-info"
85-
label="PLG_SYSTEM_OPENGRAPH_TIPS_LABEL"
86-
description="PLG_SYSTEM_OPENGRAPH_TIPS_DESC" />
87-
</fieldset>
8868
</fields>
8969
</config>
9070
</extension>

plugins/system/opengraph/src/Extension/opengraph.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function onContentPrepareForm(PrepareFormEvent $event): void
143143
$categoryId = (int) $article->catid;
144144
}
145145
}
146-
146+
$catParams = new Registry();
147147
if ($categoryId > 0) {
148148
/** @var MVCComponent $catComponent */
149149
$catComponent = $app->bootComponent('com_categories');
@@ -158,7 +158,9 @@ public function onContentPrepareForm(PrepareFormEvent $event): void
158158
$catParams = new Registry($category->params ?? '{}');
159159
}
160160

161-
161+
if (!$catParams) {
162+
return;
163+
}
162164
// Get the mappings from the category params
163165
$mappings = [];
164166
foreach ($catParams as $paramKey => $fieldName) {
@@ -265,9 +267,7 @@ public function onBeforeCompileHead(BeforeCompileHeadEvent $event): void
265267
['ignore_request' => true]
266268
);
267269
$categoryModel->setState('category.id', $article->catid);
268-
$category = $categoryModel->getItem($article->catid);
269-
270-
270+
$category = $categoryModel->getCategory();
271271

272272

273273
// Get menu parameters

0 commit comments

Comments
 (0)