Componette

Componette

HostBox

HostBox / nette-social-plugins v1.5.2

Social Plugins for Nette Framework - Support for Facebook, Twitter, Google+, LinkedIn and Pinterest

download-cloud-line composer require hostbox/nette-component-social-plugins

Social Plugins for Nette Framework Build Status

Support for Facebook, Twitter, Google+, LinkedIn and Pinterest

Facebook:

  • Activity feed
  • Comments
  • Embedded post
  • Facepile
  • Follow button
  • Like box
  • Like button
  • Send button
  • Share button

Twitter:

  • Follow button
  • Hashtag button
  • Mention button
  • Share button
  • Embedded timeline
  • Embedded favorites
  • Embedded search

Google+:

  • +1 button
  • Share button
  • Profile badge
  • Page badge
  • Community badge

LinkedIn:

  • Company insider
  • Company profile
  • Member profile
  • Share button
  • Recommend button

Pinterest:

  • Pin It button
  • Follow button
  • Pin widget
  • Profile widget
  • Board widget

Package Installation

The best way to install Social Plugins is using Composer:

$ composer require hostbox/nette-component-social-plugins

Packagist - Versions

Nette Forum (cs) - plugin section

Nette Addons

or manual edit composer.json in your project

"require": {
    "hostbox/nette-component-social-plugins": "v1.5.0"
}

Component Installation

config.neon

services:
    # Configs
    - HostBox\Components\Facebook\SocialPlugins\Config('facebookAppId')
    - HostBox\Components\Twitter\SocialPlugins\Config
    - HostBox\Components\Google\SocialPlugins\Config
    # Factories
    - HostBox\Components\Facebook\SocialPlugins\FacebookFactory
    - HostBox\Components\Twitter\SocialPlugins\TwitterFactory
    - HostBox\Components\Google\SocialPlugins\GoogleFactory
    - HostBox\Components\Pinterest\SocialPlugins\PinterestFactory

Presenter

use HostBox\Components\Facebook\SocialPlugins\LikeBox;
use HostBox\Components\Google\SocialPlugins\GoogleFactory;
use HostBox\Components\Google\SocialPlugins\PlusOneButton;
use HostBox\Components\Pinterest\SocialPlugins\PinItButton;
use HostBox\Components\Pinterest\SocialPlugins\PinterestFactory;
use HostBox\Components\Twitter\SocialPlugins\FollowButton;
use HostBox\Components\Twitter\SocialPlugins\TwitterFactory;

class HomepagePresenter extends BasePresenter {

    /** @var FacebookFactory */
    protected $facebookFactory;

    /** @var TwitterFactory */
    protected $twitterFactory;

    /** @var GoogleFactory */
    protected $googleFactory;

    /** @var PinterestFactory */
    protected $pinterestFactory;

    /**
     * @var LinkedInFactory
     * @inject
     */
    public $linkedInFactory;

    public function __construct(FacebookFactory $facebookFactory, TwitterFactory $twitterFactory, GoogleFactory $googleFactory, PinterestFactory $pinterestFactory) {
        $this->facebookFactory = $facebookFactory;
        $this->twitterFactory = $twitterFactory;
        $this->googleFactory = $googleFactory;
        $this->pinterestFactory = $pinterestFactory;
    }

    // component create by Factory
    public function createComponentFacebookLikeButton() {
        return $this->facebookFactory->createLikeButton();
    }

    // default settings by factory function parameter
    public function createComponentFacebookLikeBox() {
        return $this->facebookFactory->createLikeBox(array(
            'colorScheme' => LikeBox::COLOR_SCHEME_DARK,
            'showFaces' => TRUE
        ));
    }

    // by component function parameter
    public function createComponentTwitterShareButton() {
        $component = $this->twitterFactory->createFollowButton();
        $component->assign(array(
            'size' => FollowButton::SIZE_LARGE,
            'showCount' => TRUE
        ));

        return $component;
    }

    // by component variable
    public function createComponentGooglePlusOneButton() {
        $component = $this->googleFactory->createPlusOneButton();
        $component->size = PlusOneButton::SIZE_SMALL;

        return $component;
    }

    public function createComponentLinkedInShareButton() {
        return $this->linkedInFactory->createShareButton();
    }

    public function createComponentPinterestFollowButton() {
        return $this->pinterestFactory->createFollowButton(array(
            'userName' => 'pinterest',
            'text' => 'Pinterest'
        ));
    }
}

Template

{control facebookLikeButton}

// temporary(only for this render) settings editing in Template
{control facebookLikeButton, layout => 'box_count', showFaces => true}

{control facebookLikeBox}
{control twitterShareButton}
{control googlePlusOneButton}
{control linkedInShareButton}
{control pinterestFollowButton}

{control facebookLikeButton:jsScript}
{control twitterShareButton:jsScript}
{control googlePlusOneButton:jsScript}
{control linkedInShareButton:jsScript}
{control pinterestFollowButton:jsScript}
  • v1.5.2 Released version 1.5.2

    Added forgotten setting (width) for Facebook Embedded Post

  • v1.5.1 Released version 1.5.1

    Fix Twitter Embedded Timeline

  • v1.5.0 Released version 1.5.0

    Fixed temporary template settings
    Added tests for plugins render

  • v1.4.0 Released version 1.4.0

    • Fixed PinterestFactory - createProfileWidget return type
    • Added Tests
  • v1.3.2 Released version 1.3.2

    Code cleanup
    Fix LinkedIn - Member profile plugin

  • v1.1.2 Released version 1.1.2

    Fix Facebook Follow and Like buttons default value

  • v1.1.1 Released version 1.1.1

    typos

  • v1.3.1 Released version 1.3.1

    Code cleanup

  • v1.0.1 Released version 1.0.1

    Support for Facebook, Twitter and G+

    Facebook:

    • Activity feed
    • Comments
    • Embedded post
    • Facepile
    • Follow button
    • Like box
    • Like button
    • Send button
    • Share button

    Twitter:

    • Follow button
    • Hashtag button
    • Mention button
    • Share button
    • Embedded timeline
    • Embedded favorites
    • Embedded search

    Google+:

    • +1 button
    • Share button
    • Profile badge
    • Page badge
    • Community badge
  • v1.3.0 Released version 1.3.0

    Support for LinkedIn

    • Company insider
    • Company profile
    • Member profile
    • Share button
    • Recommend button
  • v1.2.0 Released version 1.2.0

    Support for Pinterest

    • Pin It button
    • Follow button
    • Pin widget
    • Profile widget
    • Board widget
  • v1.1.0 Released version 1.1.0

    Factories

Componette Componette felix@nette.org