PHP Class Xpressengine\Widget\WidgetHandler

## app binding * xe.widget 으로 바인딩 되어 있음 * Widget Facade 제공 ## 생성자에서 필요한 항목들 * PluginRegister $register - 등록된 위젯 정보를 획득하기 위한 plugin register * GuardInterface $guard - 위젯을 render 할 때 현재 접속한 사용자의 권한을 확인하기 위한 guard * Factory $view - 렌더링을 하기위한 view factory ## 사용법 ### Widget Id 에 해당하는 클래스 이름 획득 php $handler->getClassName($id) ### Widget Id 에 해당하는 위젯 HTML 렌더링 코드 반환 * widget id 와 렌러링에 필요한 arguments param array 를 인자로 전달 php $handler->create($id, $args = []) ### Widget Id 에 설정 view form 반환 * 위젯 코드를 생성하기 위한 설정 화면에 대한 view form 반환 php $handler->setUp($id); ### 원하는 위젯 class List 반환 * filter 를 전달하여 원하는 widget class 정보를 획득한다 php $handler->getAll(callable $filter = null); ### Widget Id 에 해당하는 위젯 코드(custom xml)을 획득한다 * widget id 와 렌러링에 필요한 arguments param array 를 인자로 전달 php $handler->getGeneratedCode($id, array $inputs)
Author: XE Team (developers) ([email protected])
Show file Open project: xpressengine/xpressengine Class Usage Examples

Public Properties

Property Type Description
$displayErrorRatings array super and manager can error view on render widget exception occur

Protected Properties

Property Type Description
$debugMode debug mode
$guard Xpressengine\User\GuardInterface
$register plugin registry manager 등록된 Widget 조회하기 위하여 사용됨

Public Methods

Method Description
__construct ( PluginRegister $register, Xpressengine\User\GuardInterface $guard, Illuminate\Contracts\View\Factory $view, boolean $debugMode = false ) 생성자
generateCode ( string $widgetId, array $inputs ) : string generate widget code by widget id and config given
generateXml ( string $element, array $inputs, integer $depth ) : string xml string을 생성하여 반환한다. element명과 element의 attr, child elements 정보를 입력받는다.
getAll ( callable $filter = null ) : array retrive all of registered widget
getClassName ( string $widgetId ) : mixed 주어진 id로 등록된 Widget 반환한다.
render ( string $widgetId, array $args = [] ) : mixed create
setup ( string $widgetId, array $configs = [] ) : mixed render widget setting form

Protected Methods

Method Description
fullWidgetId ( string $widgetId ) : string prefix를 포함한 완전한 widget id를 반환한다.
getInstance ( string $widgetId, null $args = null ) : AbstractWidget getInstance

Method Details

__construct() public method

생성자
public __construct ( PluginRegister $register, Xpressengine\User\GuardInterface $guard, Illuminate\Contracts\View\Factory $view, boolean $debugMode = false )
$register Xpressengine\Plugin\PluginRegister plugin registry manager
$guard Xpressengine\User\GuardInterface guard instance
$view Illuminate\Contracts\View\Factory illuminate view factory
$debugMode boolean debug mode

fullWidgetId() protected method

prefix를 포함한 완전한 widget id를 반환한다.
protected fullWidgetId ( string $widgetId ) : string
$widgetId string widget id
return string

generateCode() public method

generate widget code by widget id and config given
public generateCode ( string $widgetId, array $inputs ) : string
$widgetId string widget id
$inputs array widget config data
return string

generateXml() public method

xml string을 생성하여 반환한다. element명과 element의 attr, child elements 정보를 입력받는다.
public generateXml ( string $element, array $inputs, integer $depth ) : string
$element string xml element명
$inputs array 설정값 또는 하위설정 데이터
$depth integer 들여쓰기 레벨
return string

getAll() public method

retrive all of registered widget
public getAll ( callable $filter = null ) : array
$filter callable filter
return array

getClassName() public method

주어진 id로 등록된 Widget 반환한다.
public getClassName ( string $widgetId ) : mixed
$widgetId string 반환할 Widget id
return mixed

getInstance() protected method

getInstance
protected getInstance ( string $widgetId, null $args = null ) : AbstractWidget
$widgetId string widget id
$args null widget config data
return AbstractWidget

render() public method

create
public render ( string $widgetId, array $args = [] ) : mixed
$widgetId string widget id
$args array to create widget html arguments
return mixed

setup() public method

render widget setting form
public setup ( string $widgetId, array $configs = [] ) : mixed
$widgetId string widget id
$configs array widget config data
return mixed

Property Details

$debugMode protected property

debug mode
protected $debugMode

$displayErrorRatings public static property

super and manager can error view on render widget exception occur
public static array $displayErrorRatings
return array

$guard protected property

protected GuardInterface,Xpressengine\User $guard
return Xpressengine\User\GuardInterface

$register protected property

plugin registry manager 등록된 Widget 조회하기 위하여 사용됨
protected $register