summaryrefslogtreecommitdiff
path: root/classes/feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-10-24 20:11:49 +0300
committerAndrew Dolgov <[email protected]>2021-10-24 20:11:49 +0300
commit933913410c10c580f698d76771eb067c4dce10f1 (patch)
tree8b4c9854897ce1866eec4833caad628029160c2c /classes/feeds.php
parent9f734c90506a6e5916589d7c8f39c45ff40f6273 (diff)
css: make plugin button container a flexbox
backend: pass plugin button generated code through domdocument to ensure its correctness; set data-plugin-name attribute on children to make them sortable via css
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-xclasses/feeds.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index db62bd6a8..819fdacb0 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -230,17 +230,43 @@ class Feeds extends Handler_Protected {
$line["feed_title"] = $line["feed_title"] ?? "";
+ $button_doc = new DOMDocument();
+
$line["buttons_left"] = "";
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_LEFT_BUTTON,
- function ($result) use (&$line) {
- $line["buttons_left"] .= $result;
+ function ($result, $plugin) use (&$line, &$button_doc) {
+ if ($button_doc->loadXML($result)) {
+
+ /** @var DOMElement|null */
+ $child = $button_doc->firstChild;
+
+ if ($child) {
+ do {
+ $child->setAttribute('data-plugin-name', get_class($plugin));
+ } while ($child = $child->nextSibling);
+
+ $line["buttons_left"] .= $button_doc->saveXML($button_doc->firstChild);
+ }
+ }
},
$line);
$line["buttons"] = "";
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_BUTTON,
- function ($result) use (&$line) {
- $line["buttons"] .= $result;
+ function ($result, $plugin) use (&$line, &$button_doc) {
+ if ($button_doc->loadXML($result)) {
+
+ /** @var DOMElement|null */
+ $child = $button_doc->firstChild;
+
+ if ($child) {
+ do {
+ $child->setAttribute('data-plugin-name', get_class($plugin));
+ } while ($child = $child->nextSibling);
+
+ $line["buttons"] .= $button_doc->saveXML($button_doc->firstChild);
+ }
+ }
},
$line);