Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4.0][api][com_content] render the image field (#29630)
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Api | ||
* @subpackage com_content | ||
* | ||
* @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\Content\Api\Helper; | ||
|
||
\defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Uri\Uri; | ||
|
||
/** | ||
* Content api helper. | ||
* | ||
* @since 4.0 | ||
*/ | ||
class ContentHelper | ||
{ | ||
/** | ||
* Fully Qualified Domain name for the image url | ||
* | ||
* @param string $uri The uri to resolve | ||
* | ||
* @return string | ||
*/ | ||
public static function resolve(string $uri): string | ||
{ | ||
// Check if external URL. | ||
if (stripos($uri, 'http') !== 0) | ||
{ | ||
return Uri::root() . $uri; | ||
} | ||
|
||
return $uri; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters