<?php

/**
 * @package     Joomla.Site
 * @subpackage  mod_articles_news
 *
 * @copyright   (C) 2010 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\Layout\LayoutHelper;

$additionalFields = array();
foreach($item->jcfields as $field) {
	$additionalFields[$field->name] = $field->value;
}
?>
<?php if ($params->get('img_intro_full') !== 'none' && !empty($item->imageSrc)) : ?>
    <figure class="newsflash-image">
        <?php echo LayoutHelper::render(
            'joomla.html.image',
            [
                'src' => $item->imageSrc,
                'alt' => $item->imageAlt,
            ]
        ); ?>
        <?php if (!empty($item->imageCaption)) : ?>
            <figcaption>
                <?php echo $item->imageCaption; ?>
            </figcaption>
        <?php endif; ?>
    </figure>
<?php endif; ?>

<?php if (!$params->get('intro_only')) : ?>
    <?php echo $item->afterDisplayTitle; ?>
<?php endif; ?>

<?php echo $item->beforeDisplayContent; ?>
<?php if ($params->get('item_title')) : ?>

    <div class="newsflash-title">
    <?php if ($item->link !== '' && $params->get('link_titles')) : ?>
        <a href="<?php echo $item->link; ?>">
            <?php echo $item->title; ?>
        </a>
    <?php else : ?>
        <?php echo $item->title; ?>
    <?php endif; ?>
    </div>
<?php endif; ?>

<?php if ($params->get('show_introtext', 1)) : ?>
    <div class="spoiler">
		<?php echo $item->introtext; ?>
	</div>
<?php endif; ?>

<? if (isset($additionalFields['tsenazametr']) and !empty($additionalFields['tsenazametr'])) :?>
	<div class="tsena-za-metr"><?php echo $additionalFields['tsenazametr']; ?></div>
<?php endif;?>

<?php echo $item->afterDisplayContent; ?>

<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) : ?>
    <?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $item, 'params' => $item->params, 'link' => $item->link]); ?>
<?php endif; ?>
