activestate Posted January 3, 2020 Posted January 3, 2020 Hi, Recently i'm building small blog, and seems i'm too small to figure out how to do the following: As admin i I've created new field - select field which holds blog categories. Later i coded some repeater to have following fields: title, thumb image, textarea, (CKEditor) and my select field that holds categories. When i log as editor, everything is working fine, i can add new blog entry and select proper category. The problem is that as editor i don't have any option to add new categories if needed .... Is there any way for editor (non super admin) to edit field somehow ? Thank you ! Jack Edit, as admin i've added module Page edit field permission and configured, but when i'm loogged as editor, i see no such option to edit this select field (last screensshot).
dragan Posted January 3, 2020 Posted January 3, 2020 I would choose a page reference field for your categories, instead of a select field. A select field is "static", i.e. you have to add/edit/remove categories yourself, and therefore need the necessary rights. With a page reference field, you can pre-define categories, and in the field-config allow users to add new ones. In case you didn't use page reference fields until now, I suggest you learn more about them. Here's a truly epic tutorial (old, but the fundamental logic still applies all these years later...) 1
activestate Posted January 3, 2020 Author Posted January 3, 2020 Thank you @dragan. Seems you pointed me a right direction. I'm just wondering about Quote with a page reference field, you can pre-define categories How can i pre-define this ? Should this field contain maybe a repeater with just single values ? Thanks.
activestate Posted January 3, 2020 Author Posted January 3, 2020 Sorry @dragan but i think i get your point. You think i should use "pages" as categories and seems i'm almost done. Did you think about such approach ? Thanks.
activestate Posted January 3, 2020 Author Posted January 3, 2020 Alright @dragan, your clue was essential to archive my goal, it;s working fine. Have w cool weekend bro. Cheers.
dragan Posted January 3, 2020 Posted January 3, 2020 12 minutes ago, activestate said: You think i should use "pages" as categories and seems i'm almost done. Did you think about such approach ? Exactly. That's the preferred "PW way" to do such stuff. It may seem weird at first glance, but once you realize that in PW everything is a page (not just what you render as "page" in the frontend), you can do all kinds of stuff. Think of a PW-page as basically a container than can contain any kind of content, and can be cross-referenced and queried. Don't have time right now to point you to docs/more tutorials, sorry. I always create a dummy template "empty" (naming is up to you; it doesn't need a physical .php file, because it doesn't need to be viewable in the frontend) just for this reason: it has only a title field and nothing else. And you can re-use it as many times as you need, without creating more templates than needed. Just create a new parent page as container for every new category / attribute or whatever you're using it for, so you can reference it in your page reference selector. And with setups like that, if you rename a category, you don't have to update all instances manually (avoid redundancy etc.etc.) 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now