后端扩展字段未正确保存[OctoberCMS]

时间:2016-06-07 09:38:37

标签: php forms laravel octobercms

我扩展了octobercms的后端(../backend/cms)并且我的所有字段都正常工作但是我有一个转发器类型字段,当我尝试预览返回的页面时,它没有正确保存错误:

" Class name is not registered for the component "str_local_og_fb_admins". Check the component plugin."

我已经在myoctober / theme / demo / pages检查了页面文件,我发现转发器字段(设置[str_local_og_fb_admins])并没有像其他字段一样保存。

这是页面文件:

title = "Demonstration"
url = "/"
layout = "default"
is_hidden = 0
str_seo_title = "drdf"
str_seo_description = "hhh"
str_seo_keywords = "meta keywords"
str_canonical_url = "canonical url" <!--this are the other fields, they all work properly -->
str_robot_index = "noindex"
str_robot_follow = "nofollow"
str_local_og_more = "<meta name=\":d\" content=\":3\">
<meta name=\"more\" content=\"more\">"

[str_local_og_fb_admins] <!-- this is the repeater field -->
1[settings][str_local_og_fb_admin] = 0 <!--I have saved this value "0"-->
== 
 (...)

这是我的plugin.php,我扩展了后端字段:

public function boot()
        {
          Event::listen('backend.form.extendFields', function($widget)
            {
              if (!$widget->model instanceof \Cms\Classes\Page) return;
              if (starts_with($widget->arrayName, "settings[str_local_og_fb_admin]"))
                              return;
              //cms page fields
                        $widget->addFields([
                          'settings[str_seo_title]' =>[
                            'label' => 'Meta Title',
                            'tab'     => 'SEO',
                            'type' => 'text'
                          ],
                          'settings[str_seo_description]' =>[
                            'label' => 'Meta Description',
                            'tab'     => 'SEO',
                            'size'    => 'small',
                            'type' => 'textarea'
                          ],
                          'settings[str_seo_keywords]' =>[
                            'label' => 'Meta Keywords',
                            'tab'     => 'SEO',
                            'type' => 'text'
                          ],
                          'settings[str_canonical_url]' => [
                                        'label'   => 'Canonical URL',
                                        'type'    => 'text',
                                        'tab'     => 'SEO',

                                    ],
                          'settings[str_robot_index]' => [
                            'label'   => 'Robot Index',
                            'type'    => 'dropdown',
                            'tab'     => 'SEO',
                            'options' => ["index"=>"index","noindex"=>"noindex"],
                            'default' => 'index',
                            'span'    => 'left'
                          ],
                          'settings[str_robot_follow]' => [
                            'label'   => 'Robot Follow',
                            'type'    => 'dropdown',
                            'tab'     => 'SEO',
                            'options' => ["follow"=>"follow","nofollow"=>"nofollow"],
                            'default' => 'follow',
                            'span'    => 'right'
                          ],
                          'settings[str_local_og_sitename]' => [
                            'label'   => 'Site name',
                            'tab'     => 'Open Graph',
                            'type'  => 'text',
                            'placeholder' => 'Example: strong answer',
                          ],
                          'settings[str_local_og_title]' => [
                            'label' => 'Title',
                            'type'  => 'text',
                            'placeholder' => 'Example: New features',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_description]' => [
                            'label' => 'Description',
                            'type'  => 'textarea',
                            'size'  => 'small',
                            'placeholder' => 'Example: seo plugin is a plugin that handles meta tags',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_url]' => [
                            'label' => 'Page url',
                            'placeholder' => 'Example: http://www.strong-answer.com/',
                            'type'  => 'text',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_type]' => [
                            'label' => 'Type',
                            'type'  => 'text',
                            'placeholder' => 'Example: website',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_author]' => [
                            'label' => 'Author',
                            'type'  => 'text',
                            'placeholder' => 'Example: Strong Answer',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_img]' => [
                            'label' => 'Image path',
                            'type'  => 'text',
                            'placeholder' => 'http://october.com/storage/app/media/Koala.jpg',
                            'tab'   => 'Open Graph',
                          ],
                          'settings[str_local_og_gl_title]' => [
                            'label' => 'Name for the post',
                            'type'  => 'text',
                            'placeholder' => 'Example: My post title',
                            'tab'   => 'Google Tags',
                          ],
                          'settings[str_local_og_gl_description]' => [
                            'label' => 'The description of your post',
                            'type'  => 'textarea',
                            'size'    => 'small',
                            'placeholder' => 'Example: seo plugin is a plugin that handles meta tags',
                            'tab'   => 'Google Tags',

                          ],
                          'settings[str_local_og_gl_img]' => [
                            'label' => 'The image of your post',
                            'type'  => 'text',
                            'placeholder' => 'Example: http://october.com/storage/app/media/Koala.jpg',
                            'tab'   => 'Google Tags',
                          ],
                          'settings[str_local_og_gl_page]' => [
                            'label' => 'Business page link',
                            'type'  => 'text',
                            'placeholder' => 'Example: www.epicsite.com',
                            'tab'   => 'Google Tags',
                          ],
                          'settings[str_local_og_tt_card]' => [
                            'label' => 'Summary of your card',
                            'type'  => 'textarea',
                            'size'  =>  'small',
                            'placeholder' => 'Example: Happy 3rd anniversary #TBT!',
                            'tab'   => 'Twitter Tags',
                          ],
                          'settings[str_local_og_tt_site]' => [
                            'label' => 'Twitter user',
                            'type'  => 'text',
                            'placeholder' => 'Example: @stronganswer',
                            'tab'   => 'Twitter Tags',
                          ],
                          'settings[str_local_og_tt_title]' => [
                            'label' => 'Twitter title',
                            'type'  => 'text',
                            'placeholder' => 'Example: Small Island Developing States Photo Submission',
                            'tab'   => 'Twitter Tags',
                          ],
                          'settings[str_local_og_tt_description]' => [
                            'label' => 'Twitter description',
                            'type'  => 'textarea',
                            'size'  => 'small',
                            'placeholder' => 'Example: seo plugin is a plugin that handles meta tags',
                            'tab'   => 'Twitter Tags',
                          ],
                          'settings[str_local_og_tt_img]' => [
                            'label' => 'Twitter image',
                            'type'  => 'text',
                            'placeholder' => 'Example: http://october.com/storage/app/media/Koala.jpg',
                            'tab'   => 'Twitter Tags',
                          ],
                          'settings[str_local_og_fb_appid]' => [
                            'label' => 'Facebook App Id',
                            'type'  => 'text',
                            'placeholder' => 'Example: 302184056577324',
                            'tab'   => 'Facebook Tags',
                          ],       
     //this is the repeater field:
                    'settings[str_local_og_fb_admins]' => [
                            'label' => 'Facebook Admins',
                            'type'  => 'repeater',
                            'tab'   => 'Facebook Tags',
                            'form' => [
                              'fields' => [
                                'settings[str_local_og_fb_admin]' => [
                                  'label' => 'Facebook Admin',
                                  'type' => 'text'
                                ]
                              ]
                            ]
                          ]
              ],  'primary');

                   });

            }

这是我正在谈论的领域:

repeater field

这是错误页面:

error

如何使转发器字段正确保存?

(我希望它像这样保存&#34; str_local_og_more = 0&#34;不是&#34; [str_local_og_fb_admins] 1 [settings] [str_local_og_fb_admin] = 0&#34;)

0 个答案:

没有答案