anand-patel / oc-seo-extension

SEO Extension for October CMS Pages
12 stars 29 forks source link

repeater field is bugged after installing this plugin #25

Open raakesh opened 8 years ago

raakesh commented 8 years ago

After installing this plugin the repeater is not working as it should be, meta tag fields of this plugin are also repeating with the fields of the repeater.

`{repeater name="content_sections" prompt="Add More"}

{text name="title" label="Title"}Title{/text}

{/repeater}`

After installation https://www.dropbox.com/s/ezjuiu1lj8bqnu1/after-installation.png?dl=0

Before installation https://www.dropbox.com/s/g3hxnrusd2ux4i0/before-installation.png?dl=0

MarpoOcknew commented 6 years ago

This is something I've noticed is still happening. Its a simple fix for it but you can hide the extra fields with this css. Just add it to the backend additional css tab in october.

.field-repeater-form div[data-field-name="viewBag[seo_title]"],
.field-repeater-form div[data-field-name="viewBag[seo_description]"],
.field-repeater-form div[data-field-name="viewBag[seo_keywords]"],
.field-repeater-form div[data-field-name="viewBag[canonical_url]"],
.field-repeater-form div[data-field-name="viewBag[redirect_url]"],
.field-repeater-form div[data-field-name="viewBag[robot_index]"],
.field-repeater-form div[data-field-name="viewBag[robot_follow]"] {
    display: none;
}
d-nightmare commented 6 years ago

Instead of hiding it, this small check gets rid of them completely as arrayName only gets populated within the repeater:

 if(PluginManager::instance()->hasPlugin('RainLab.Pages') && $widget->model instanceof \RainLab\Pages\Classes\Page)
            {
                // skip adding meta fields for repeater-fields
                if(!is_null($widget->arrayName)) { return; };

                $widget->addFields([.....