Redaxscript\Modules\ShareThis\ShareThis::render PHP Method

render() public static method

render
Since: 2.2.0
public static render ( string $url = null ) : string
$url string
return string
    public static function render($url = null)
    {
        $output = null;
        if ($url) {
            /* html elements */
            $linkElement = new Html\Element();
            $linkElement->init('a', ['target' => '_blank']);
            $listElement = new Html\Element();
            $listElement->init('ul', ['class' => self::$_configArray['className']['list']]);
            /* process network */
            foreach (self::$_configArray['network'] as $key => $value) {
                $output .= '<li>';
                $output .= $linkElement->attr(['class' => self::$_configArray['className']['link'] . ' ' . $value['className'], 'data-height' => $value['height'], 'data-type' => $key, 'data-width' => $value['width'], 'href' => $value['url'] . $url])->text($key);
                $output .= '</li>';
            }
            /* collect list output */
            if ($output) {
                $output = $listElement->html($output);
            }
        }
        return $output;
    }