Last active
November 9, 2020 18:58
-
-
Save hans2103/a559db83e300b120d392974e6cf64fd8 to your computer and use it in GitHub Desktop.
Clean Joomla Social Share block
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
<?php | |
// somewhere in on of your overrides | |
use Joomla\CMS\Layout\LayoutHelper; | |
// file is stored in your template /html/layouts/template/block/share.php | |
?><p>Share this item</p><?php | |
echo LayoutHelper::render('template.block.share', array('title' => 'damn good title')); |
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
<?php | |
// remove this line: /templates/perfectemplate/layout/render.php | |
/** | |
* @package PerfectTemplate | |
* @copyright 2019 Perfect Web Team / perfectwebteam.nl | |
* @license GNU General Public License version 3 or later | |
*/ | |
use Joomla\CMS\Factory; | |
defined('_JEXEC') or die; | |
class PWTLayout | |
{ | |
/** | |
* Function to get PWT Layout file | |
* | |
* @param $type | |
* @param string $data | |
* | |
* @return string | |
* | |
* @since version | |
* @throws Exception | |
*/ | |
public static function render($type, $data = '') | |
{ | |
$template = Factory::getApplication()->getTemplate(); | |
$jlayout = new JLayoutFile($type, JPATH_THEMES . '/' . $template . '/html/layouts/template'); | |
return $jlayout->render($data); | |
} | |
/** | |
* function to get svg icon | |
* | |
* @param $type | |
* | |
* @return string | |
* | |
* @since 1.0.0 | |
* @throws Exception | |
*/ | |
public static function icon($type) | |
{ | |
$template = Factory::getApplication()->getTemplate(); | |
return file_get_contents(JPATH_THEMES . '/' . $template . '/icons/' . $type . '.svg'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment