Class kartik\social\Module
| Inheritance | kartik\social\Module » kartik\base\Module » yii\base\Module » yii\di\ServiceLocator » yii\base\Component » yii\base\BaseObject |
|---|---|
| Implements | kartik\base\BootstrapInterface, yii\base\Configurable |
| Uses Traits | kartik\base\BootstrapTrait, kartik\base\TranslationTrait |
| Available since version | 1.0 |
Module for configuring all social widgets
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $aliases | array | List of path aliases to be defined. The array keys are alias names (must
start with @) and the array values are the corresponding paths or aliases. See setAliases() for an
example. |
yii\base\Module |
| $basePath | string | The root directory of the module. | yii\base\Module |
| $behaviors | yii\base\Behavior[] | List of behaviors attached to this component. | yii\base\Component |
| $bsColCssPrefixes | array | The bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. | kartik\base\BootstrapTrait |
| $bsCssMap | array | CSS conversion mappings across bootstrap library versions. | kartik\base\BootstrapTrait |
| $bsExtBasename | integer | The yii2 bootstrap extension base name (readonly property available via getter method getBsExtBasename()) | kartik\base\BootstrapTrait |
| $bsVer | integer | Bootstrap version number currently set (readonly property available via getter method getBsVer()) | kartik\base\BootstrapTrait |
| $bsVersion | integer|string | The bootstrap library version that you wish to use for this specific extension / widget. | kartik\base\BootstrapTrait |
| $components | array | The list of the component definitions or the loaded component instances (ID => definition or instance). | yii\di\ServiceLocator |
| $controllerMap | array | Mapping from controller ID to controller configurations. | yii\base\Module |
| $controllerNamespace | string|null | The namespace that controller classes are in. | yii\base\Module |
| $controllerPath | string | The directory that contains the controller classes. | yii\base\Module |
| $defaultBtnCss | string | Default bootstrap button CSS (readonly property available via getter method getDefaultBtnCss()) | kartik\base\BootstrapTrait |
| $defaultIconPrefix | string | Default icon prefix (readonly property available via getter method getDefaultIconPrefix()) | kartik\base\BootstrapTrait |
| $defaultRoute | string | The default route of this module. | yii\base\Module |
| $disqus | array | The disqus configuration. | kartik\social\Module |
| $dropdownClass | string | Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) | kartik\base\BootstrapTrait |
| array | The facebook api configuration. | kartik\social\Module | |
| $fb | \Facebook\Facebook | Object | kartik\social\Module |
| $fbLoginLink | string | The generated login link | kartik\social\Module |
| $github | array | The github buttons api configuration. | kartik\social\Module |
| $githubX | array | The github extended alternative buttons api configuration. | kartik\social\Module |
| array | The google api configuration. | kartik\social\Module | |
| $googleAnalytics | array | The google analytics api configuration. | kartik\social\Module |
| $i18n | array | The the internalization configuration for this widget. | kartik\base\TranslationTrait |
| $id | string | An ID that uniquely identifies this module among other modules which have the same parent. | yii\base\Module |
| $layout | string|boolean|null | The layout that should be applied for views within this module. | yii\base\Module |
| $layoutPath | string | The root directory of layout files. Defaults to "$viewPath/layouts". | yii\base\Module |
| $module | yii\base\Module|null | The parent module of this module. | yii\base\Module |
| $modules | array | The modules (indexed by their IDs). | yii\base\Module |
| $params | array | Custom module parameters (name => value). | yii\base\Module |
| array | The twitter api configuration. | kartik\social\Module | |
| $uniqueId | string | The unique ID of the module. | yii\base\Module |
| $version | string | The version of this module. Note that the type of this property differs in getter and setter. See getVersion() and setVersion() for details. | yii\base\Module |
| $viewPath | string | The root directory of view files. Defaults to "$basePath/views". | yii\base\Module |
| $vk | array | The VKontakte api configuration. | kartik\social\Module |
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $_bsVer | integer | Current bootstrap version number | kartik\base\BootstrapTrait |
| $_defaultBtnCss | string | Default bootstrap button CSS | kartik\base\BootstrapTrait |
| $_defaultIconPrefix | string | Default icon CSS prefix | kartik\base\BootstrapTrait |
| $_isBs4 | boolean | Flag to detect whether bootstrap 4. | kartik\base\BootstrapTrait |
| $_msgCat | string | Translation message file category name for i18n. | kartik\social\Module |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __call() | Calls the named method which is not a class method. | yii\base\Component |
| __clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
| __construct() | Constructor. | yii\base\Module |
| __get() | Returns the value of a component property. | yii\base\Component |
| __isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
| __set() | Sets the value of a component property. | yii\base\Component |
| __unset() | Sets a component property to be null. | yii\base\Component |
| addCssClass() | Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
| afterAction() | This method is invoked right after an action within this module is executed. | yii\base\Module |
| attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
| attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
| beforeAction() | This method is invoked right before an action within this module is executed. | yii\base\Module |
| behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
| canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
| canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
| className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
| clear() | Removes the component from the locator. | yii\di\ServiceLocator |
| createController() | Creates a controller instance based on the given route. | yii\base\Module |
| createControllerByID() | Creates a controller based on the given controller ID. | yii\base\Module |
| detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
| detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
| ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
| get() | Returns the component instance with the specified ID. | yii\base\Module |
| getBSClass() | Gets the respective Bootstrap class based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
| getBasePath() | Returns the root directory of the module. | yii\base\Module |
| getBehavior() | Returns the named behavior object. | yii\base\Component |
| getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
| getBsVer() | Gets the current set bootstrap version number. | kartik\base\BootstrapTrait |
| getComponents() | Returns the list of the component definitions or the loaded component instances. | yii\di\ServiceLocator |
| getControllerPath() | Returns the directory that contains the controller classes according to $controllerNamespace. | yii\base\Module |
| getCssClass() | Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type. | kartik\base\BootstrapTrait |
| getDefaultBtnCss() | Gets the default button CSS | kartik\base\BootstrapTrait |
| getDefaultIconPrefix() | Gets the default icon css prefix | kartik\base\BootstrapTrait |
| getDropdownClass() | Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
| getFb() | Gets the Facebook object based on supplied parameters or uses module level facebook settings | kartik\social\Module |
| getFbLoginLink() | Generates and returns a facebook login link | kartik\social\Module |
| getInstance() | Returns the currently requested instance of this module class. | yii\base\Module |
| getLayoutPath() | Returns the directory that contains layout view files for this module. | yii\base\Module |
| getModule() | Retrieves the child module of the specified ID. | yii\base\Module |
| getModules() | Returns the sub-modules in this module. | yii\base\Module |
| getUniqueId() | Returns an ID that uniquely identifies this module among all modules within the current application. | yii\base\Module |
| getVersion() | Returns current module version. | yii\base\Module |
| getViewPath() | Returns the directory that contains the view files for this module. | yii\base\Module |
| has() | Returns a value indicating whether the locator has the specified component definition or has instantiated the component. | yii\base\Module |
| hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
| hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
| hasModule() | Checks whether the child module of the specified ID exists. | yii\base\Module |
| hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
| init() | Initializes the module. | kartik\base\Module |
| initI18N() | Yii i18n messages configuration for generating translations | kartik\base\TranslationTrait |
| isBs() | Validate Bootstrap version | kartik\base\BootstrapTrait |
| isBs4() | Validate if Bootstrap 4.x version. | kartik\base\BootstrapTrait |
| off() | Detaches an existing event handler from this component. | yii\base\Component |
| on() | Attaches an event handler to an event. | yii\base\Component |
| removeCssClass() | Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
| runAction() | Runs a controller action specified by a route. | yii\base\Module |
| set() | Registers a component definition with this locator. | yii\di\ServiceLocator |
| setAliases() | Defines path aliases. | yii\base\Module |
| setBasePath() | Sets the root directory of the module. | yii\base\Module |
| setComponents() | Registers a set of component definitions in this locator. | yii\di\ServiceLocator |
| setControllerPath() | Sets the directory that contains the controller classes. | yii\base\Module |
| setFb() | Sets the Facebook object based on supplied parameters or uses module level facebook settings | kartik\social\Module |
| setInstance() | Sets the currently requested instance of this module class. | yii\base\Module |
| setLayoutPath() | Sets the directory that contains the layout files. | yii\base\Module |
| setModule() | Adds a sub-module to this module. | yii\base\Module |
| setModules() | Registers sub-modules in the current module. | yii\base\Module |
| setVersion() | Sets current module version. | yii\base\Module |
| setViewPath() | Sets the directory that contains the view files. | yii\base\Module |
| trigger() | Triggers an event. | yii\base\Component |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| checkFbConfig() | Check if a facebook configuration variable is set | kartik\social\Module |
| configureBsVersion() | Configures the bootstrap version settings | kartik\base\BootstrapTrait |
| defaultVersion() | Returns default module version. | yii\base\Module |
| getBsExtBasename() | The yii2-bootstrap extension base name. | kartik\base\BootstrapTrait |
| initBsVersion() | Initializes bootstrap versions for the widgets and asset bundles. | kartik\base\BootstrapTrait |
| isSameVersion() | Compares two versions and checks if they are of the same major BS version. | kartik\base\BootstrapTrait |
| parseVer() | Parses and returns the major BS version | kartik\base\BootstrapTrait |
Events
| Event | Type | Description | Defined By |
|---|---|---|---|
| EVENT_AFTER_ACTION | yii\base\ActionEvent | An event raised after executing a controller action. | yii\base\Module |
| EVENT_BEFORE_ACTION | yii\base\ActionEvent | An event raised before executing a controller action. | yii\base\Module |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| FB_GRAPH_VER | 'v2.8' | Default facebook graph api version | kartik\social\Module |
Property Details
Translation message file category name for i18n.
The disqus configuration. You can setup these keys. These can be overridden at the widget level.
settings: array, the configuration for the discus widgetshortname: string, the disqus forum shortnameidentifier: string, the disqus identifier for your pagetitle: string, the disqus title of the current pageurl: string, the URL of the current page. If not set will be set to value ofwindow.location.href.- `category_id: string, the category to be used for the current page. This is used when creating the thread on Disqus for the first time.
- `disable_mobile: boolean, disable use of mobile optimized version of Disqus.
showCount: boolean, whether to display the comment count summary instead of the detailed Disqus standard comments widget.noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
The facebook api configuration. You can setup these keys:
app_idorappId: string, the Facebook Application ID. This is mandatory.app_secretorsecret: string, the Facebook Application Secret. This is mandatory.- `default_graph_version: string, the default graph version. Defaults to FB_GRAPH_VER.
default_access_token: string, the default facebook access token (optional).persistent_data_handler: Facebook\PersistentData\PersistentDataInterface, defaults to new class instance ofkartik\social\FacebookPersistentHandler.noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
Object
The generated login link
'email', 'user_posts'
], $fb = null )
The github buttons api configuration. You can setup these keys:
- type`: string, the Github button type.
- settings`: array, the configuration for the GitHub buttons widget
- options`: array, the HTML attributes for the GitHub buttons iframe container.
noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
The github extended alternative buttons api configuration. You can setup these keys:
type: string, the Github button type.user: string, the Github user name.repo: string, the Github repo name.settings: array, the configuration for the GitHub buttons widgetoptions: array, the HTML attributes for the GitHub buttons iframe container.noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
The google api configuration. You can setup these keys:
- clientId`: string, the Google Client ID. This is mandatory.
- secret`: string, the Google Client Application Secret. This is mandatory.
noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
The google analytics api configuration. You can setup these keys:
id: string, the Google Analytics Tracking ID.domain: string, the domain name of your website where the tracking code will be displayed.newVersion: boolean, whether to insert the new version of the google analytics tracking code. Defaults totrue.oldVersion: boolean, whether to insert the old version of the google analytics tracking code. Defaults tofalse.
The twitter api configuration. You can setup these keys:
screenName: string, the Twitter Screen Name. This is mandatory for follow, mention, and hashtag buttons.hashTag: string, the Twitter Hash Tag.noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
The VKontakte api configuration. You can setup these keys:
- `apiId: string|int, the VK API identifier.
noscript: string|boolean, text to be displayed if browser does not support javascript. If set tofalse, this will not displayed.noscriptOptions: array, HTML attributes for the noscript message container. Defaults to:['class' => 'alert alert-danger'].
Method Details
Check if a facebook configuration variable is set
| protected static void checkFbConfig ( $var = '', $val = null ) | ||
| $var | string | The variable name in the configuration |
| $val | string | The variable value to test |
| throws | yii\base\InvalidConfigException | |
|---|---|---|
Gets the Facebook object based on supplied parameters or uses module level facebook settings
| public \Facebook\Facebook getFb ( $params = [] ) | ||
| $params | array | The parameters to be set for the facebook session. If not set, will use the module level facebook settings. |
| return | \Facebook\Facebook | Object |
|---|---|---|
| throws | yii\base\InvalidConfigException | |
| throws | \Facebook\Exceptions\FacebookSDKException | |
Generates and returns a facebook login link
| public string getFbLoginLink ( $callback = '#', $options = [], $permissions = [ 'email', 'user_posts' ], $fb = null ) | ||
| $callback | string | The absolute callback url action that will be used by Facebook SDK redirect login helper. |
| $options | array | The HTML attributes for the login link. The following special options are recognized:
|
| $permissions | array | The permissions for the user to be authenticated by the login helper. Defaults to
|
| $fb | \Facebook\Facebook | The facebook object. If not provided will default to the object retrieved by |
| return | string | The generated login link |
|---|---|---|
| throws | yii\base\InvalidConfigException | |
| throws | \Facebook\Exceptions\FacebookSDKException | |
Sets the Facebook object based on supplied parameters or uses module level facebook settings
| public void setFb ( $params = [] ) | ||
| $params | array|null | , if set to null the facebook object will be set to a null value. If set as an array,
the
|
| throws | yii\base\InvalidConfigException | |
|---|---|---|
| throws | \Facebook\Exceptions\FacebookSDKException | |