Ok, understood. Add the column 'note' into the SELECT statement and use the function loadObject to retrieve the columns from the row. The module note field is not part of the column 'params'.
Update:
On a second thought, the object $params is already available as a separate object and its values are already json_decoded. Therefore 'note' can be the only column in the SELECT statement and loadResult() will work.
This is the suggested override script:
Update:
On a second thought, the object $params is already available as a separate object and its values are already json_decoded. Therefore 'note' can be the only column in the SELECT statement and loadResult() will work.
This is the suggested override script:
Code:
<?php/** * @package Joomla.Site * @subpackage mod_custom * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */defined('_JEXEC') or die;use Joomla\CMS\Factory;use Joomla\CMS\HTML\HTMLHelper;use Joomla\CMS\Uri\Uri;$moduleId = $module->id;// Access the database$db = Factory::getDbo();// Prepare a query to fetch the note column$query = $db->getQuery(true)->select('note')->from($db->quoteName('#__modules'))->where($db->quoteName('id') . ' = ' . $db->quote($moduleId));// Set the query and load the column$db->setQuery($query);$moduleNote = $db->loadResult();// Add inline styles for the background image if set$modStyleId = 'mod-custom' . $moduleId;if ($params->get('backgroundimage')) { /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); $wa->addInlineStyle('#' . $modStyleId . '{background-image: url("' . Uri::root(true) . '/' . HTMLHelper::_('cleanImageURL', $params->get('backgroundimage'))->url . '");}', ['name' => $modId]);}// Output the Note fieldecho '<div id="' . htmlspecialchars($modId, ENT_QUOTES, 'UTF-8') . '" class="mod-custom custom">';echo htmlspecialchars($moduleNote, ENT_QUOTES, 'UTF-8');echo $module->content;echo '</div>';
Statistics: Posted by toivo — Sat Jul 27, 2024 5:47 am