ryan Posted February 28, 2012 Share Posted February 28, 2012 Continuing from the Repeaters thread about the field-template context… This video demonstrates how you can adjust the admin context of individual fields according to the template they are placed in. When you adjust the context in this manner, it only changes the settings for when a field appears in that template. This expands the reusability potential of fields across different templates, hopefully preventing the need to create another field if all you really needed was a different title, description or width. You can do this same type of configuration when editing a field in a repeater too. View this full screen which should put YouTube into HD mode, where it's much easier to see. 8 Link to comment Share on other sites More sharing options...
raydale Posted February 28, 2012 Share Posted February 28, 2012 Continuing from above about the field-template context… This video demonstrates how you can adjust the admin context of individual fields according to the template they are placed in. When you adjust the context in this manner, it only changes the settings for when a field appears in that template. This expands the reusability potential of fields across different templates, hopefully preventing the need to create another field if all you really needed was a different title, description or width. You can do this same type of configuration when editing a field in a repeater too. View this full screen which should put YouTube into HD mode, where it's much easier to see. Um... wow!!! This just made my day! Thanks for the video Ryan. I'm so impressed with the speed of development on ProcessWire. Field contexts should be a UX designers dream. Of all the features lately this is definitely my favourite - so powerful when combined with repeating fields. I have struggled for so long with other CMS's to get the admin interface to become usable and friendly for clients - this is a massive step forward for me - as constantly creating new fields for various templates just to change a field title was a tad cumbersome. I really like the modal windows to set the new field contexts along with the width settings - so useful. 1 Link to comment Share on other sites More sharing options...
Pete Posted February 28, 2012 Share Posted February 28, 2012 My jaw is somewhere near the floor after that video ryan - that's amazing! Not only due to the fact that you can give names and descriptions (amongst other things) for fields on a per-template basis, but also seeing a very good usage scenario for the resized field widths! I hadn't thought of anything as useful as that yet but can definitely see quite a few templates where that sort of layout is going to work so I'm going to start playing with them right now to vastly improve my templates 1 Link to comment Share on other sites More sharing options...
diogo Posted February 28, 2012 Share Posted February 28, 2012 Perfect! This really puts PW ahead of anything I've seen in all aspects, not only in development flexibility... 2 Link to comment Share on other sites More sharing options...
Soma Posted February 28, 2012 Share Posted February 28, 2012 This is just awesome stuff! Thanks for bringing this in Ryan! Link to comment Share on other sites More sharing options...
vknt Posted February 29, 2012 Share Posted February 29, 2012 Wow Ryan! You have no idea how long I've been dreaming of this! Thank you so much! Link to comment Share on other sites More sharing options...
ryan Posted March 3, 2012 Author Share Posted March 3, 2012 The field-template context is now committed to the source, so it is ready to use. Please let me know how it works for you guys. You can access it from any template or repeater field by clicking on a field name in the asmSelect list. When you first add a new field to an existing asmSelect, the context option isn't yet available. You have to save the template before you'll see the option to alter its context. When editing a field (from Setup > Fields), you will also see a context pulldown in the upper right corner. This is just a shortcut when/if you want it. -- Edit: you may need to hit 'reload' in your browser once or twice if you aren't seeing the field context option at first (old files may be stuck in cache). 3 Link to comment Share on other sites More sharing options...
diogo Posted March 3, 2012 Share Posted March 3, 2012 It works great Ryan! I'm in love with this new feature! Repeated fields and field-template context, used in the right amount, are extremely powerful for creating a friendly edit environment. I really think this brings PW to a new dimension 2 Link to comment Share on other sites More sharing options...
Soma Posted March 3, 2012 Share Posted March 3, 2012 I'm already loving it without trying! Awesome work Ryan, thanks for implementing this, diogo is right , this is playing in a whole new league. 2 Link to comment Share on other sites More sharing options...
Adam Kiss Posted March 4, 2012 Share Posted March 4, 2012 So, this is live in stable version? Link to comment Share on other sites More sharing options...
apeisa Posted March 8, 2012 Share Posted March 8, 2012 I am really loving this feature, great stuff Ryan! One very minor thing I noticed: if you have added template context settings for title field, it doesn't use those on /page/add/?parent_id=12008 page (first view when adding new pages). Link to comment Share on other sites More sharing options...
ryan Posted March 8, 2012 Author Share Posted March 8, 2012 Thanks Antti, just fixed in latest commit. This applies to situations where you are adding a page somewhere and only 1 template is allowed (per the parent page's template family settings). Link to comment Share on other sites More sharing options...
PawelGIX Posted March 11, 2012 Share Posted March 11, 2012 This is really useful. I have some suggestion: to add a button to a modal dialog: "Restore Defaults". Are you planning to add the ability to create context aware field. $inputfields = parent::___getConfigInputfields(); $field = $this->modules->get("InputfieldTextarea"); $field->attr ('name', 'name'); $field->useInContext = true; //something like that $field->label = $this->_ ("Label"); Link to comment Share on other sites More sharing options...
ryan Posted March 12, 2012 Author Share Posted March 12, 2012 to add a button to a modal dialog: "Restore Defaults". We may have to add a button like that soon. Currently it restores defaults when you set it to the blank/original unset value. But of course that prevents you from overriding a default populated value with an unpopulated one. So currently it's best to leave the default (no context) value blank if you want it to be blank/unset in any alternate template contexts. Luckily, I don't think that's a common situation (at least not here). Are you planning to add the ability to create context aware field. I'm not sure that I understand? There isn't a foundation for context outside of multiple template/fieldgroups, but maybe I'm not reading this right. Can you give me a more specific example or what you mean? Link to comment Share on other sites More sharing options...
PawelGIX Posted March 13, 2012 Share Posted March 13, 2012 I asked exactly what is mentioned here;) Being able to change the other field settings (beyond label, description, columnWidth, visibility) is actually supported in the core, but I've got the system blocking it right now because I'm worried about side effects here. For example: If I wanted to create AnotherImageInputField, which would allow me to set a"Minimum files allowed" in the options. Then in the settings of each template, I could override this setting if it was needed. But really, I can always create a new field for each template. So I actually think it is better not to complicate simple things. I use the PW too short to know whether such a possibility would be useful Link to comment Share on other sites More sharing options...
ryan Posted March 14, 2012 Author Share Posted March 14, 2012 If I wanted to create AnotherImageInputField, which would allow me to set a"Minimum files allowed" in the options.Then in the settings of each template, I could override this setting if it was needed. I think this is a good example of why I'm a little scared of supporting context for any factor. If you set "max files" to "1" in one context, and "0" in another, then those fields are going to behave differently from the API (Pagefile vs array of Pagefiles). Same thing with a Page reference field, where you can define its type with the field (Page, PageArray, NullPage, false). I think it could cause a confusion and bugs in people's code. Another example is just a plain text field. It might have an entities encoder added to it in one context, and not in another. That could be not just confusing, but an output and potential security issue (depending on the source of the text). Uncontrolled field contexts are a bit of a can of worms. So before we open up context beyond the existing built-in factors, I want to come up with a way for fieldtype authors to identify a factor as being safe (or not safe) for multi-context. Link to comment Share on other sites More sharing options...
Soma Posted March 14, 2012 Share Posted March 14, 2012 I spoted an issue when using this on repeater fields list. The percent text doesn't stay after saving the field. Link to comment Share on other sites More sharing options...
ryan Posted March 16, 2012 Author Share Posted March 16, 2012 Soma, that was fixed earlier this week. Might require a JS refresh though. Let me know if you still experience the issue. Link to comment Share on other sites More sharing options...
Soma Posted March 16, 2012 Share Posted March 16, 2012 No it's gone, guess it was a cache problem. Only happened first time. Thanks! Link to comment Share on other sites More sharing options...
zach Posted March 21, 2012 Share Posted March 21, 2012 I just installed the latest updates Awesome stuff Ryan! I can now spend more time thinking about what I want out of my site and less about the admin UX hurdles I was anticipating. @Soma I had the same problem with settings not saving and then I remembered your post about clearing the cache. Problem solved! Link to comment Share on other sites More sharing options...
marcin Posted March 26, 2012 Share Posted March 26, 2012 Is there need to update database somehow? I have Cache module turned off and I experience simillar issue as Soma. Link to comment Share on other sites More sharing options...
Soma Posted March 26, 2012 Share Posted March 26, 2012 marcin, it has nothing to do with PW cache, which is not enabled by default anyway and only for frontend. PW has no cache, we were talking about browser cache there. Link to comment Share on other sites More sharing options...
marcin Posted March 26, 2012 Share Posted March 26, 2012 Okay, I understand. Unfortunately, it still doesn't work, any ideas? EDIT: OK, it works I think. I cleared cache in Opera, and tested in Chrome. Lame. Thank you, people. Link to comment Share on other sites More sharing options...
vitor Posted March 27, 2012 Share Posted March 27, 2012 It was not working with Safari, only with Chrome, but the latest version, fixed this, I've tested myself and it is working. What browser are you using, marcin? is ProcessWire the latest version? Best Link to comment Share on other sites More sharing options...
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