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

Custom Path and some other options not settable #103

Open
samyouel opened this issue Jan 12, 2024 · 2 comments
Open

Custom Path and some other options not settable #103

samyouel opened this issue Jan 12, 2024 · 2 comments

Comments

@samyouel
Copy link

Hey!
I'm on a multipage setup, where I define the root paths for the content folders etc in the /index.php file like so:

  $kirby = new Kirby([
    'roots' => [
      ...
      'content'  => $dynamic_directory . '/content',
      ...
    ],
  ]);

Now I set the content folder path in the settings (in the ready part of the settings, so the dynamic kirby root for content is available) :

'ready' => function ($kirby) {
    return [
    'thathoff.git-content.path' => $kirby->root("content"),
    ]},

Now the Problem

The settings are completely ignored by the plugin, in the same way the settings for commitMessage and menuLabel (maybe even more that's the ones I checked). Some of the settings, like commit, or pull are taken from the settings.

At first I thought it might be because of the ready part in my settings but even without that the custom path is not recognised.

In the constructor in site/plugins/git-content/src/KirbyGitHelper.php:24~29 it says:

    public function __construct($repoPath = false)
    {
        $this->kirby = kirby();
        $this->repoPath = $repoPath ? $repoPath : option('thathoff.git-content.path', $this->kirby->root("content"));
        $this->commitMessageTemplate = option('thathoff.git-content.commitMessage', ':action:(:item:): :url:');
    }

It seems like this is fired too early in the chain, even before the settings from the config.php are read.

-> Can you reproduce?

I would appreciate it if this works :)
Thank you!

@thathoff
Copy link
Owner

Yes setting the options in the ready hook is not supported as the plugin already initialises the KirbyGit class when being loaded. But, the plugin should use the content folder automatically. And it did in all cases I’ve used a different / dynamic content folder. So from my point of view the problem is something different. 🤔

@samyouel
Copy link
Author

samyouel commented Mar 1, 2024

Okay, so the ready won't be able to work. Cool, at least that makes sense.

I've tried this again and it's actually still not working. In the meantime I've altered the plugin's source file, but that's obviously not a solution.
Would be cool to find a solution here. Thank you!

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