public function link($service, $text, $url = null, array $attributes = [])
    {
        $defaults = [
            'target' => $this->_config['target']
        ];
        $attributes += $defaults;

        $options = [];

        if (!empty($attributes['text'])) {
            $options['text'] = $attributes['text'];
            unset($attributes['text']);
        }

        if (!empty($attributes['image'])) {
            $options['image'] = $attributes['image'];
            unset($attributes['image']);
        }

        return $this->Html->link(
            $text,
            $this->href($service, $url, $options),
            $attributes
        );
    }
public function link($service, $text, $url = null, array $attributes = [])
    {
        $defaults = [
            'target' => $this->_config['target']
        ];
        $attributes += $defaults;

        $options = [];

        if (!empty($attributes['text'])) {
            $options['text'] = $attributes['text'];
            unset($attributes['text']);
        }

        if (!empty($attributes['image'])) {
            $options['image'] = $attributes['image'];
            unset($attributes['image']);
        }

        return $this->Html->link(
            $text,
            $this->href($service, $url, $options),
            $attributes
        );
    }
public function link ( $ service , $ text , $ url = null , array $ attributes = [ ] ) { $ defaults = [ 'target' => $ this -> _config [ 'target' ] ] ; $ attributes += $ defaults ; $ options = [ ] ; if ( ! empty ( $ attributes [ 'text' ] ) ) { $ options [ 'text' ] = $ attributes [ 'text' ] ; unset ( $ attributes [ 'text' ] ) ; } if ( ! empty ( $ attributes [ 'image' ] ) ) { $ options [ 'image' ] = $ attributes [ 'image' ] ; unset ( $ attributes [ 'image' ] ) ; } return $ this -> Html -> link ( $ text , $ this -> href ( $ service , $ url , $ options ) , $ attributes ) ; }
Creates an HTML link to share a URL.

@param string $service Social Media service to create share link for.
@param string $text The content to be wrapped by <a> tags.
@param string|array $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
@param array $attributes Array of options and HTML attributes.
@return string An `<a />` element.
Creates an HTML link to share a URL .