This commit is contained in:
2024-12-31 11:07:09 +01:00
parent df7915205d
commit e089172b15
1916 changed files with 165422 additions and 271 deletions

View File

@ -0,0 +1,53 @@
<?php
/**
* @version CVS: 1.0.0
* @package Com_Highlights
* @author Eddy Prosperi <eddy.prosperi@protocollicreativi.it>
* @copyright 2024 Eddy Prosperi
* @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt
*/
namespace Pcrt\Component\Highlights\Administrator\Service\Html;
// No direct access
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\DatabaseAwareTrait;
use Joomla\Database\DatabaseDriver;
/**
* Highlights HTML Helper.
*
* @since 1.0.0
*/
class HIGHLIGHTS
{
use DatabaseAwareTrait;
/**
* Public constructor.
*
* @param DatabaseDriver $db The Joomla DB driver object for the site's database.
*/
public function __construct(DatabaseDriver $db)
{
$this->setDbo($db);
}
public function toggle($value = 0, $view='', $field='', $i='')
{
$states = array(
0 => array('icon-unpublish', Text::_('Toggle'), ''),
1 => array('icon-publish', Text::_('Toggle'), '')
);
$state = ArrayHelper::getValue($states, (int) $value, $states[0]);
$text = '<span aria-hidden="true" class="' . $state[0] . '"></span>';
$html = '<a href="javascript:void(0);" class="tbody-icon ' . $state[2] . '"';
$html .= 'onclick="return Joomla.toggleField(\'cb'.$i.'\',\'' . $view . '.toggle\',\'' . $field . '\')" title="' . Text::_($state[1]) . '">' . $text . '</a>';
return $html;
}
}