CoreFiles by mySites.guru
modal_article.php47 lines, 1,099 bytes, from Joomla_3.7.2-Stable-Full_Package.zip
Raw History Compare with 3.7.1
md5
4fee199cd81caf1a4d14b7a34df7f479
sha1
6fb0a935e95958f9a07b36417012aead1b4a4ab3
sha256
5a17ed2f97b50056b8cfafe9a9ab43e95bcf8e537487b9899bb87c216325bb95
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

if (!key_exists('field', $displayData))
{
	return;
}

$field = $displayData['field'];
$value = $field->value;

if (!$value)
{
	return;
}

JLoader::import('joomla.application.component.model');
JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_content/models', 'ContentModel');
$model = JModelLegacy::getInstance('Article', 'ContentModel');

// If the article is not found an error is thrown we need to hold the
// old error handler
$errorHandler = JError::getErrorHandling(E_ERROR);

// Ignoring all errors
JError::setErrorHandling(E_ERROR, 'ignore');

// Fetching the article
$article = $model->getItem($value);

// Restoreing the old error handler
JError::setErrorHandling(E_ERROR, $errorHandler['mode'], $errorHandler['options']);

if ($article instanceof JException)
{
	return;
}

echo htmlentities($article->title);

The same content is in 14 releases, Joomla 3.7.0-alpha2 to 3.7.2. See them all, or every version of this file.