Ejemplo n.º 1
0
 public function testGetListOfSettingsSkin()
 {
     $skins = $this->handler->getList('module/pluginA@board', true);
     $this->assertEmpty($skins);
 }
Ejemplo n.º 2
0
 /**
  * setup by code
  *
  * @param Request       $request
  * @param WidgetParser  $widgetParser
  * @param WidgetHandler $widgetHandler
  * @param SkinHandler   $skinHandler
  *
  * @return mixed
  */
 public function setup(Request $request, WidgetParser $widgetParser, WidgetHandler $widgetHandler, SkinHandler $skinHandler)
 {
     $this->validate($request, ['code' => 'required']);
     $code = $request->get('code');
     $inputs = $widgetParser->parseCode($code);
     $widget = array_get($inputs, '@attributes.id');
     $title = array_get($inputs, '@attributes.title', '');
     // widget list
     $widgetList = $widgetHandler->getAll();
     $widgets = [];
     $widgets[''] = '위젯을 선택하세요';
     foreach ($widgetList as $id => $class) {
         $widgets[$id] = $class::getTitle();
     }
     // skin list
     $skins = $skinHandler->getList($widget);
     // widget form
     $widgetForm = $widgetHandler->setup($widget, $inputs);
     // skin form
     $skinConfig = array_get($inputs, 'skin');
     if ($skinConfig && array_has($skinConfig, '@attributes.id')) {
         $skin = array_get($skinConfig, '@attributes.id');
         $skin = $skinHandler->get($skin);
         $skinForm = $skin->renderSetting($skinConfig);
     } else {
         $skinConfig = null;
     }
     return apiRender('widget.setup', compact('widgets', 'widget', 'title', 'skins', 'skin', 'widgetSelector', 'skinSelector', 'widgetForm', 'skinForm'));
 }