CoreFiles by mySites.guru
MailsHelper.php57 lines, 1,379 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
092a39d5265c740fe69783435de35dd8
sha1
c30384e9e121ce3da55aacf1241a45353302e6a0
sha256
7df35fdad59a08afa5ac9b61df333c9fa41ca1d568bc9bc3516bdfffc184cd5b
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_mails
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Mails\Administrator\Helper;

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;

/**
 * Mailtags HTML helper class.
 *
 * @since  4.0.0
 */
abstract class MailsHelper
{
	/**
	 * Display a clickable list of tags for a mail template
	 *
	 * @param   object  $mail       Row of the mail template.
	 * @param   string  $fieldname  Name of the target field.
	 *
	 * @return  string  List of tags that can be inserted into a field.
	 *
	 * @since   4.0.0
	 */
	public static function mailtags($mail, $fieldname)
	{
		$app = Factory::getApplication();
		Factory::getApplication()->triggerEvent('onMailBeforeTagsRendering', array($mail->template_id, &$mail));

		if (!isset($mail->params['tags']) || !count($mail->params['tags']))
		{
			return '';
		}

		$html = '<ul class="list-group">';

		foreach ($mail->params['tags'] as $tag)
		{
			$html .= '<li class="list-group-item">'
				. '<a href="#" class="edit-action-add-tag" data-tag="{' . strtoupper($tag) . '}" data-target="' . $fieldname . '"'
					. ' title="' . $tag . '">' . $tag . '</a>'
				. '</li>';
		}

		$html .= '</ul>';

		return $html;
	}
}

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.