pkp / textEditorExtras

An OJS plugin to add controls to the rich text editor to upload images, manipulate the HTML code, and add tables.
GNU General Public License v3.0
3 stars 14 forks source link

Error with announcements #23

Closed loadbrain closed 9 months ago

loadbrain commented 9 months ago

OMP/OJS 3.4.0.4

When annocuncements are enabled and you click on settings from the plugin you get an error:

`Got error 'PHP message: PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /omp/cache/t_compile/91ff704559266117e7aac9c23546d1f88865748a^aad0d99d45f1c49794dd5f48888b070605c1db6e_0.plugins-1-plugins-generic-textEditorExtras-generic-textEditorExtras.settings.tpl.php:117 Stack trace:\n#0 /omp/cache/t_compile/91ff704559266117e7aac9c23546d1f88865748a^aad0d99d45f1c49794dd5f48888b070605c1db6e_0.plugins-1-plugins-generic-textEditorExtras-generic-textEditorExtras.settings.tpl.php(117): in_array()\n

1

/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_65683105dcb739_31632149()\n#2 /v /omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#3 /omp/lib...' ` If announcementes is disabled, everything works fine.

loadbrain commented 9 months ago

is_array... is missing in settings.tpl. see also: https://github.com/pkp/textEditorExtras/pull/21 Fixed with: ` {if $currentContext->getData('enableAnnouncements')}

{translate key="announcement.announcements"}
            <tr>
                <th scope="row">{translate key="plugins.generic.textEditorExtras.setting.announcements.descriptionShort"}</th>
                <td><input type="checkbox" name="additions[announcement][descriptionShort][]" value="image" {if is_array($additions.announcement.descriptionShort) && in_array('image', $additions.announcement.descriptionShort)}checked="checked"{/if}></td>
                <td><input type="checkbox" name="additions[announcement][descriptionShort][]" value="code" {if is_array($additions.announcement.descriptionShort) && in_array('code', $additions.announcement.descriptionShort)}checked="checked"{/if}></td>
                <td><input type="checkbox" name="additions[announcement][descriptionShort][]" value="table" {if is_array($additions.announcement.descriptionShort) && in_array('table', $additions.announcement.descriptionShort)}checked="checked"{/if}></td>
            </tr>
        {/if}`
stephaniegalloOU commented 7 months ago

@loadbrain Does this resolve issue #20?

loadbrain commented 7 months ago

@loadbrain Does this resolve issue #20?

Yes I think so