示例#1
0
 public function install(\Floxim\Floxim\Component\Infoblock\Entity $ib, $ctr, $params)
 {
     if (!isset($params['form_id']) || !$params['form_id']) {
         $form = fx::data('floxim.form.form')->create(array('name' => 'My new form'));
         $form->save();
         $ib->digSet('params.form_id', $form['id']);
         $ib->save();
         fx::log('ib savd', $ib, $params, $form);
     }
 }
示例#2
0
 protected function getFormatFields(CompInfoblock\Entity $infoblock, $area_meta = null)
 {
     $i2l = $infoblock->getVisual();
     $fields = array(array('label' => "Area", 'name' => 'area', 'value' => $i2l['area'], 'type' => 'hidden'));
     $layout_name = fx::data('layout', $i2l['layout_id'])->get('keyword');
     $controller_name = $infoblock->getPropInherited('controller');
     $action_name = $infoblock->getPropInherited('action');
     $area_suit = Template\Suitable::parseAreaSuitProp(isset($area_meta['suit']) ? $area_meta['suit'] : '');
     $force_wrapper = $area_suit['force_wrapper'];
     $default_wrapper = $area_suit['default_wrapper'];
     $wrappers = array();
     $c_wrapper = '';
     if (!$force_wrapper) {
         $wrappers[''] = fx::alang('With no wrapper', 'system');
         if ($i2l['id'] || !$default_wrapper) {
             $c_wrapper = $i2l['wrapper'];
         } else {
             $c_wrapper = $default_wrapper[0];
         }
     }
     // Collect available wrappers
     $layout_tpl = fx::template('theme.' . $layout_name);
     if ($layout_tpl) {
         $avail_wrappers = \Floxim\Floxim\Template\Suitable::getAvailableWrappers($layout_tpl, $area_meta);
         foreach ($avail_wrappers as $avail_wrapper) {
             $wrappers[$avail_wrapper['full_id']] = $avail_wrapper['name'];
         }
         //$wrappers = array_merge($wrappers, $avail_wrappers);
     }
     // Collect the available templates
     $controller = fx::controller($controller_name . ':' . $action_name);
     $tmps = $controller->getAvailableTemplates($layout_name, $area_meta);
     if (!empty($tmps)) {
         foreach ($tmps as $template) {
             $templates[] = array($template['full_id'], $template['name']);
         }
     }
     if (count($templates) == 1) {
         $fields[] = array('name' => 'template', 'type' => 'hidden', 'value' => $templates[0][0]);
     } else {
         $fields[] = array('label' => fx::alang('Template', 'system'), 'name' => 'template', 'type' => 'select', 'values' => $templates, 'value' => $i2l['template']);
     }
     if ($controller_name != 'layout' && (count($wrappers) > 1 || !isset($wrappers['']))) {
         $fields[] = array('label' => fx::alang('Wrapper', 'system'), 'name' => 'wrapper', 'type' => 'select', 'values' => $wrappers, 'value' => $c_wrapper);
     }
     return $fields;
 }