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

Ability to hook Languages class to edit the returned $languages #54

Open
adrianbj opened this issue Nov 21, 2016 · 5 comments
Open

Ability to hook Languages class to edit the returned $languages #54

adrianbj opened this issue Nov 21, 2016 · 5 comments

Comments

@adrianbj
Copy link

Short description of the enhancement

I want to be able to add some logic in a module to remove some languages from $languages

Why would the enhancement be useful to users?

The module I want to build will allow devs to hide certain languages from the page editor on a branch by branch basis. I have a site that only needs additional languages for certain branches of the page tree. Having the additional languages appear for the page name, text and textarea fields in the other branches is just a distraction/confusion for the site editors.

At the moment I can't see a way to hook into the languages that are returned. I looked at making Languages::getAll hookable but because $languages is cached, this doesn't really help.

I would appreciate any thoughts you have on how best to achieve this.

Thanks!

@adrianbj
Copy link
Author

PS - here is some background: https://processwire.com/talk/topic/14237-ml-in-certain-branches-of-page-tree/

@adrianbj
Copy link
Author

adrianbj commented Nov 25, 2016

Here is the first version of the module I am working on: https://processwire.com/talk/topic/14891-restrict-multi-language-branch/

It currently supports disabling multi-language support on a page/branch basis, but ideally I would like to extend it so you can also use it to change which languages are available to a page/branch.

@Lazerproof
Copy link

+1 for that. I think that it will be great enhancement in ML site approach. Very often only non-default languages needed for some branches/pages.

@adrianbj
Copy link
Author

Hey @ryancramerdesign - any thought on this? Looks like it would be useful for others as well:
https://processwire.com/talk/topic/17014-page-in-non-default-language-only-can-it-be-done-without-separate-trees/

Thanks!

@ivangretsky
Copy link

As far as I understand, I am looking for exactly the same thing as @adrianbj described. I guess that if you can do it on "branch by branch basic" then "page be page" will also be possible. This thing seems to be really useful for larger multi-language sites as the one I am working on right now.

Esteemed @ryancramerdesign , could you please take a look at this issue while you are working on them anyway?

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

3 participants