Social Details Facebook Widget

Latest Stable Version Latest Unstable Version Total Downloads Monthly Downloads Daily Downloads
Thankful to Krajee!
to get more out of us.

NOTE: This extension depends on the kartik-v/yii2-krajee-base extension which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies that may be updated by composer.

This widget allows you to embed various Facebook plugins into your website. You should refer the Facebook plugins documentation for details on each plugin.

The FacebookPlugin widget supports these parameters.
  • language: string the language for rendering the plugin buttons. If not set, defaults to en_US. For the available languages supported by Facebook plugins, refer the list of supported language codes

  • type: string the Facebook plugin type to render. Defaults to FacebookPlugin::COMMENT. These can be one of the following values:

    • FacebookPlugin::LIKE: string for embedding the Facebook Like button.

    • FacebookPlugin::SHARE: string for embedding the Facebook Share button.

    • FacebookPlugin::SEND: string for embedding the Facebook Send button.

    • FacebookPlugin::SAVE: string for embedding the Facebook Save button.

    • FacebookPlugin::POST: string for embedding the Facebook Posts.

    • FacebookPlugin::VIDEO: string for embedding the Facebook Videos.

    • FacebookPlugin::FOLLOW: string for embedding the Facebook Follow button.

    • FacebookPlugin::COMMENT: string for embedding the Facebook Comments.

    • FacebookPlugin::PAGE: string for embedding the Facebook Page Plugin.

  • appId: string the Facebook Application ID. This is mandatory.

  • async: bool whether to load facebook JS asynchronously. Defaults to true.

  • settings: array the configuration options for each facebook plugin setup as key value pairs. Refer the Facebook plugin documentation for details on configuring each plugin.

  • options: array the HTML attributes for the main plugin. The data api attributes in this array will be automatically set based on the settings configuration.

  • tag: string the tag of the container rendering the plugin. Defaults to div.

  • noscript: string/boolean text to be displayed if browser does not support javascript. If set to false will not displayed. Defaults to Please enable JavaScript to view the comments powered by facebook.

  • noscriptOptions: array the HTML attributes for the noscript message container. Defaults to ['class' => 'alert alert-danger']

NOTE You can configure the FacebookPlugin settings once at the social module configuration level, for defaulting it across your application, and skip it in your widget calls. For example.
// your module config
'modules' => [
    'social' => [
        // the module class
        'class' => 'kartik\social\Module',

        // the global settings for the facebook widget
        'facebook' => [
            'appId' => 'FACEBOOK_APP_ID',

// your call in your view/layout file
echo FacebookPlugin::widget([]); // will use the facebook settings configured in module

Click one of the Facebook plugin links below to view details and demo for the plugin