protected function makeTemplateFormWidget($type, $template, $alias = null)
    {
        $formConfigs = [
            'page'    => '~/modules/cms/classes/page/fields.yaml',
            'partial' => '~/modules/cms/classes/partial/fields.yaml',
            'layout'  => '~/modules/cms/classes/layout/fields.yaml',
            'content' => '~/modules/cms/classes/content/fields.yaml',
            'asset'   => '~/modules/cms/classes/asset/fields.yaml'
        ];

        if (!array_key_exists($type, $formConfigs)) {
            throw new ApplicationException(trans('cms::lang.template.not_found'));
        }

        $widgetConfig = $this->makeConfig($formConfigs[$type]);
        $widgetConfig->model = $template;
        $widgetConfig->alias = $alias ?: 'form'.studly_case($type).md5($template->getFileName()).uniqid();

        return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
    }
protected function makeTemplateFormWidget($type, $template, $alias = null)
    {
        $formConfigs = [
            'page'    => '~/modules/cms/classes/page/fields.yaml',
            'partial' => '~/modules/cms/classes/partial/fields.yaml',
            'layout'  => '~/modules/cms/classes/layout/fields.yaml',
            'content' => '~/modules/cms/classes/content/fields.yaml',
            'asset'   => '~/modules/cms/classes/asset/fields.yaml'
        ];

        if (!array_key_exists($type, $formConfigs)) {
            throw new ApplicationException(trans('cms::lang.template.not_found'));
        }

        $widgetConfig = $this->makeConfig($formConfigs[$type]);
        $widgetConfig->model = $template;
        $widgetConfig->alias = $alias ?: 'form'.studly_case($type).md5($template->getFileName()).uniqid();

        return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
    }
protected function makeTemplateFormWidget ( $ type , $ template , $ alias = null ) { $ formConfigs = [ 'page' => '~/modules/cms/classes/page/fields.yaml' , 'partial' => '~/modules/cms/classes/partial/fields.yaml' , 'layout' => '~/modules/cms/classes/layout/fields.yaml' , 'content' => '~/modules/cms/classes/content/fields.yaml' , 'asset' => '~/modules/cms/classes/asset/fields.yaml' ] ; if ( ! array_key_exists ( $ type , $ formConfigs ) ) { throw new ApplicationException ( trans ( 'cms::lang.template.not_found' ) ) ; } $ widgetConfig = $ this -> makeConfig ( $ formConfigs [ $ type ] ) ; $ widgetConfig -> model = $ template ; $ widgetConfig -> alias = $ alias ? : 'form' . studly_case ( $ type ) . md5 ( $ template -> getFileName ( ) ) . uniqid ( ) ; return $ this -> makeWidget ( 'Backend\Widgets\Form' , $ widgetConfig ) ; }
Returns a form widget for a specified template type.
@param string $type
@param string $template
@param string $alias
@return Backend\Widgets\Form
Returns a form widget for a specified template type .