diff --git a/plugins/readitlater/readitlater.php b/plugins/readitlater/readitlater.php index e7a4a316..fa1c99d3 100644 --- a/plugins/readitlater/readitlater.php +++ b/plugins/readitlater/readitlater.php @@ -65,8 +65,11 @@ function hook_readitlater_render_editlink(array $data, ConfigManager $conf): arr // Load HTML into a string $html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readitlater/readitlater_editlink.html'); + // Random ID for batch shaare (multiple inputs on the same page) + $random = uniqid(); + // Replace value in HTML if it exists in $data - $html = sprintf($html, $default ? 'checked' : ''); + $html = sprintf($html, $random, $default ? 'checked' : '', $random); // field_plugin $data['edit_link_plugin'][] = $html; diff --git a/plugins/readitlater/readitlater_editlink.html b/plugins/readitlater/readitlater_editlink.html index a7d37801..1515abd5 100644 --- a/plugins/readitlater/readitlater_editlink.html +++ b/plugins/readitlater/readitlater_editlink.html @@ -1 +1 @@ -
+
diff --git a/tests/plugins/PluginReadItLaterTest.php b/tests/plugins/PluginReadItLaterTest.php index 2e145cb3..32225628 100644 --- a/tests/plugins/PluginReadItLaterTest.php +++ b/tests/plugins/PluginReadItLaterTest.php @@ -278,8 +278,8 @@ class PluginQrcodeTest extends TestCase ]; $data = hook_readitlater_render_editlink($originalData, $this->confDefaultTheme); - static::assertContainsPolyfill( - '', + static::assertRegExp( + '##', $data['edit_link_plugin'][0] ); @@ -288,8 +288,8 @@ class PluginQrcodeTest extends TestCase $data = hook_readitlater_render_editlink($originalData, $this->confDefaultTheme); - static::assertContainsPolyfill( - '', + static::assertRegExp( + '##', $data['edit_link_plugin'][0] ); } @@ -307,8 +307,8 @@ class PluginQrcodeTest extends TestCase ]; $data = hook_readitlater_render_editlink($originalData, $this->confDefaultTheme); - static::assertContainsPolyfill( - '', + static::assertRegExp( + '##', $data['edit_link_plugin'][0] ); }