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

Incompatibility when module CMS is disabled. (Cms\Classes not found) #43

Open
AdrienAdB opened this issue Jul 2, 2023 · 1 comment · May be fixed by #45
Open

Incompatibility when module CMS is disabled. (Cms\Classes not found) #43

AdrienAdB opened this issue Jul 2, 2023 · 1 comment · May be fixed by #45

Comments

@AdrienAdB
Copy link

Hi, I am mainly using WinterCMS as a backend+api with JS framework as front-end (React, Vue...).
Most of the time I disable CMS module in config/cms.php (loadModules).

Blog plugin was working well until last winter update 1.2.x
I re-enabled CMS Module to allow use of CMS\Classes.

Error: Class "Cms\Classes\Theme" not found in /var/www/xxxxx/plugins/winter/blog/models/Post.php:394

https://github.com/wintercms/wn-blog-plugin/blob/main/models/Post.php#L394

@LukeTowers
Copy link
Member

@AdrienAdB that would be because we improved our class loader to completely ignore unloaded modules and plugins in 1.2. As a general rule of thumb I recommend removing the cms module from your composer.json if you aren't using it to make these issues more obvious; however in this specific case this is a bug in the plugin in that it doesn't yet support being run in an environment like yours.

I would be more than happy to accept a PR to fix support for your use case though; it should be as simple as

/**
 * Get the list of pages that can be used to display the post
 */
public function getCmsPageOptions(): array
{
    $result = [];
   
    if (!class_exists(Theme::class)) {
        return $result;
    }
    
    // ...
}

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

Successfully merging a pull request may close this issue.

2 participants