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

Add all wireframe directories to $config->paths #22

Open
ivangretsky opened this issue Jan 21, 2022 · 3 comments
Open

Add all wireframe directories to $config->paths #22

ivangretsky opened this issue Jan 21, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ivangretsky
Copy link
Contributor

ivangretsky commented Jan 21, 2022

Good day!

I suggest we add all Wireframe paths to $config->paths for easier access. Now I see only $config->paths->partials there.

@teppokoivula
Copy link
Member

Hey @ivangretsky,

After going back and forth on this for numerous times, I ended up adding a new configuration setting for this:

$config->wireframe = [
    'global_config_paths' => [
        // 'lib',
        // 'views',
        // 'layouts',
        'partials',
        // 'components',
        // 'controllers',
    ],
];

The point is that it's now easy to decide on a site-by-site basis which paths should be stored in ProcessWire's global $config->paths object, but the default is still that only "partials" is available.

While I do believe that it might be nice to have other paths available as well (by default), at the same time I'm a little hesitant since this is indeed a global config object. Basically I'd like to avoid "polluting" any global space until there's a solid reason for that, i.e. it is a requirement to get something done :)

Again it may make sense on a per-site basis to open up more paths this way, so I do think that this new config setting makes sense. Additionally it's now very easy to later add more paths to global config, if deemed necessary.

--

Just for context:

Partials is available for both historical reasons (initially recommended approach was to use this path to include partials), so removing it is not an option (without BC break), and because static Factory class makes use of it internally. Other classes are not required by Wireframe to be publicly accessible, and they have never been publicly available, so there's no similar issue.

Anyway, let me know if you think this should still be improved. I'm open for suggestions :)

@ivangretsky
Copy link
Contributor Author

ivangretsky commented Mar 9, 2022

This looks great!

  1. Do those paths take wireframe paths settings into account?
  2. Should those global_config_paths be in sync with the new partial namespaces?

@teppokoivula
Copy link
Member

  1. Yes — as in just enabling "layouts" in global_config_paths will automatically make the configured "layouts" path available via $config->paths->layouts.
  2. Namespace paths are not (yet) supported, since they're a tad more "dynamic". That's a good point, but will require some planning. I'll definitely keep this in mind going forward with the namespace feature.

@teppokoivula teppokoivula added the enhancement New feature or request label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants