PHP Class Arrilot\Widgets\Factories\AbstractWidgetFactory

Show file Open project: arrilot/laravel-widgets Class Usage Examples

Public Properties

Property Type Description
$app ApplicationWrapperContract; Laravel application wrapper for better testability.
$skipWidgetContainer boolean The flag for not wrapping content in a special container.
$widgetFullParams array Array of widget parameters including the first one (config).
$widgetName string The name of the widget being called.
$widgetParams array Array of widget parameters excluding the first one (config).

Protected Properties

Property Type Description
$javascriptFactory JavascriptFactory Another factory that produces some javascript.
$widget Arrilot\Widgets\AbstractWidget Widget object to work with.
$widgetConfig array Widget configuration array.

Public Methods

Method Description
__call ( string $widgetName, array $params = [] ) : mixed Magic method that catches all widget calls.
__construct ( Arrilot\Widgets\Contracts\ApplicationWrapperContract $app ) Constructor.
decryptWidgetParams ( string $params ) : array Decrypt widget params that were transported via HTTP.
encryptWidgetParams ( array $params ) : string Encrypt widget params to be transported via HTTP.

Protected Methods

Method Description
instantiateWidget ( array $params = [] ) Set class properties and instantiate a widget object.
parseFullWidgetNameFromString ( $widgetName ) : string Convert stuff like 'profile.feedWidget' to 'Profile\FeedWidget'.
wrapContentInContainer ( $content ) : string Wrap the given content in a container if it's not an ajax call.

Method Details

__call() public method

Magic method that catches all widget calls.
public __call ( string $widgetName, array $params = [] ) : mixed
$widgetName string
$params array
return mixed

__construct() public method

Constructor.
public __construct ( Arrilot\Widgets\Contracts\ApplicationWrapperContract $app )
$app Arrilot\Widgets\Contracts\ApplicationWrapperContract

decryptWidgetParams() public method

Decrypt widget params that were transported via HTTP.
public decryptWidgetParams ( string $params ) : array
$params string
return array

encryptWidgetParams() public method

Encrypt widget params to be transported via HTTP.
public encryptWidgetParams ( array $params ) : string
$params array
return string

instantiateWidget() protected method

Set class properties and instantiate a widget object.
protected instantiateWidget ( array $params = [] )
$params array

parseFullWidgetNameFromString() protected method

Convert stuff like 'profile.feedWidget' to 'Profile\FeedWidget'.
protected parseFullWidgetNameFromString ( $widgetName ) : string
$widgetName
return string

wrapContentInContainer() protected method

Wrap the given content in a container if it's not an ajax call.
protected wrapContentInContainer ( $content ) : string
$content
return string

Property Details

$app public property

Laravel application wrapper for better testability.
public ApplicationWrapperContract; $app
return ApplicationWrapperContract;

$javascriptFactory protected property

Another factory that produces some javascript.
protected JavascriptFactory,Arrilot\Widgets\Factories $javascriptFactory
return JavascriptFactory

$skipWidgetContainer public static property

The flag for not wrapping content in a special container.
public static bool $skipWidgetContainer
return boolean

$widget protected property

Widget object to work with.
protected AbstractWidget,Arrilot\Widgets $widget
return Arrilot\Widgets\AbstractWidget

$widgetConfig protected property

Widget configuration array.
protected array $widgetConfig
return array

$widgetFullParams public property

Array of widget parameters including the first one (config).
public array $widgetFullParams
return array

$widgetName public property

The name of the widget being called.
public string $widgetName
return string

$widgetParams public property

Array of widget parameters excluding the first one (config).
public array $widgetParams
return array