Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent v6 - Pages in ModelAdmin Localizing in another Locale throws error #810

Open
MLindenhofer opened this issue Sep 13, 2023 · 3 comments

Comments

@MLindenhofer
Copy link
Contributor

Hi,

We have a project with CMS: 4.12.0 and Fluent 6.0.0 with some PageTypes managed in a ModelAdmin. All Pages have a proper Fluent+Elemental setup.

Clicking "Copy to draft" or "Copy & Publish" throws this error: "Could not find a suitable form-action callback function"

Clicking "Localise" works but we'll get the blue message: "A draft has been created for this locale, however, published content may still be inherited from another. To publish this content for this locale, use the "Save & publish" action provided." - and there are no options to do a "Save & Publish" action.

The only workarounds atm are downgrading to Fluent 5 as it works there or to work in Split-mode to get redirected from ModelAdmin to SiteTree - where "Copy to draft" and "Copy & Publish" work as they should.

So this seems to be a bug in Fluent 6.
Can you fix it please?

Thanks in advance

@tractorcow
Copy link
Collaborator

I think the issue is with the custom modeladmin for those page types. The main fluent sitetree actions were added to CMSMain extension, so you may need to add some extensions to your custom modeladmin too (not only the model itself).

Here's the config for CMSMain. Can you add the same but for your custom modeladmin?

SilverStripe\CMS\Controllers\CMSMain: # Your modeladmin here
  extensions:
    FluentLeftAndMainExtension: TractorCow\Fluent\Extension\FluentCMSMainExtension

@tractorcow
Copy link
Collaborator

It looks like v5 doesn't need that extension on CMSMain, so that will be the reason :)

@MLindenhofer
Copy link
Contributor Author

I tried it right now, but it doesn't work with that either. Same error as before. Our custom model admin is nothing special, there is only the method to add the VisibleLocalesColumn to the GridField in there.

For example:

class LandingPageAdmin extends ModelAdmin
{
    private static string $menu_title = 'Landing Pages';

    private static string $url_segment = 'landing-pages';

    private static string $menu_icon_class = 'font-icon-graph-bar';

    private static float $menu_priority = -0.5;

    private static array $managed_models = [
        LandingPage::class
    ];

    public function getGridFieldConfig(): GridFieldConfig
    {
        $config = parent::getGridFieldConfig();
        $config->addComponent(new VisibleLocalesColumn());
        return $config;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants