Joss Posted December 7, 2014 Share Posted December 7, 2014 I think this idea has come up a couple of times in other threads, but this is just to rationalise it a little. Currently, the Page Table works rather like a repeater in that it is a way of adding and arranging new content in sections via a field. However, because it works in a more public way (the pages created can be arranged within a publically accessible part of the tree rather than buried under admin), the potential for the field is greater than with repeaters. Primarily, there is the opportunity for the field to have the characteristics of a page field. Take this case: A complex, technical article about using Processwire will be much improved by the use of additional information in the form of asides. Using a page table, it is possible to create the five or six asides needed, sort them into the right order and then insert them into the right places using hanna code. (the hanna code could either call them using their key in the array, or by title or by page id, even - if it were displayed) However, in such an article, it would be also very useful to use an existing aside. For instance, the nice aside "what is php?" might be very useful. But that does mean that it needs to be selected from the existing stock and that is not currently possible with a page table, though it is possible with a page field. What it looks like If the functionality were added to the page table field, this is how I would see it being used in practice: On the creation of the page table field, under the option for selecting a parent, a check box is added "allow selection of existing page" When using the field on a template, where currently you have "Add New" at the bottom of the field you now have a second button "Select" This opens up a lister in a modal window where you can select one or more Asides from the given parent as set in the field. These are then added to the list of asides in the field. Preventing Editing One of the dangers of such a system is that the content of a page called by a page table might be edited out of context. Back to our field! A third checkbox says "prevent editing if used in more than one page." Basically, if our aside is used in more than one page it can no longer be edited from the page table field. The only way it can be edited is by going to the page directly as normal via the page tree, and that might be subject to permission restrictions. There may also be a situation where asides are created in their position within a page tree and the ability to edit them via a page table is completely removed for everyone. Perhaps that is an automatic feature where the aside is created via the page tree and not via a page table field. However, in this case where an aside is not editable, another option may be available: Cloning Another possibility is the idea of New from Old. for instance, I want to use that very good aside about what is PHP but I want to add my own relevant information. In this case I can choose my starter aside and click on "Create New from this aside" in the lister modal. A new aside will be created using the same template and the same content which I can then edit. Limiting Inclusion There are situations in this case, however, where an aside has content that is really limited to that one article and should not be reused. (Legal reasons, perhaps, or just simple editorial context). Back on the field settings there would be another check box "allow limited use" Now, when as Aside is created, on the modal window in the Settings tab it has a checkbox that says "Limit to this article only?" This Aside can now not be selected for use by another article. Other Uses Using this modification as an aside is a very basic example, but there are probably hundreds of others. For instance, product variations or attributes in e-commerce where certain variations need to be available to a range of products. With e-commerce, the various restrictions about editing and limiting inclusion would become very important. So there you go, a lot more power and uses. (Note: this might be the wrong starting point, of course, as it could be argued that this should be a modification of a page field!) 5 Link to comment Share on other sites More sharing options...
thetuningspoon Posted December 15, 2014 Share Posted December 15, 2014 I'll add my backing to this request Modifying the page field so that it can support modal editing of a selected page would be another (perhaps simpler) approach to solving some of these scenarios. Link to comment Share on other sites More sharing options...
Joss Posted December 15, 2014 Author Share Posted December 15, 2014 One thing about use of a modal in the back end - how does this work out with mobiles and small tablets? I haven't tried, I must admit. Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 16, 2015 Share Posted January 16, 2015 So I spent some time fiddling around with this tonight and managed to get modal editing of page field pages working with the addition of just a few lines of code in InputfieldPage.module: InputfieldPage.module The modified file is attached. I commented the lines that I added with /* MJS 1/15/15 */ You'll want to put this file into /site/modules/ so you don't overwrite the core. Once it's up there, you should see an option in the field config settings for your page field that says 'Allow pages to be edited from field?' Check the box. This only works if you're using ASMSelect with your page field. The catch is that you have to save the page before the modal edit links become available (like when editing fields in the template editor). I think the only way around this would be to significantly re-engineer the ASMSelect inputfield with some AJAXy stuff. Not my strong suit. EDIT: There is a module for this now with more features. Use it instead! https://processwire.com/talk/topic/9857-module-page-field-edit-links/ 7 Link to comment Share on other sites More sharing options...
Nico Knoll Posted January 16, 2015 Share Posted January 16, 2015 Looks nice to me Link to comment Share on other sites More sharing options...
Joss Posted January 16, 2015 Author Share Posted January 16, 2015 ooh, I will try this later! Nice one. Link to comment Share on other sites More sharing options...
Macrura Posted January 21, 2015 Share Posted January 21, 2015 @everfree.. did you see my version of this - might be similar.. (yours looks a lot more definitive..) my version is super simple, just enables a feature that as Soma pointed out is already in the core; and then using some jQuery, enables the editing of pages in other types of page selects like autocomplete, page list select etc.. https://processwire.com/talk/topic/8477-adminpageselecteditlinks-module-for-enabling-edit-links-on-multipage-selects/?p=82020 2 Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 21, 2015 Share Posted January 21, 2015 Totally missed that one! Looks like you beat me to it. Yes, I am using the built-in edit link feature (which Ryan already uses for context-editing of fields in the Template editor) and am passing in the link for editing the page. Then I just added in an option to the field's config settings to enable this on a per-field basis. But this isn't ideal because it's not a separate module and it only works for ASM, so your module is probably the better bet I'll have to give it a try. Link to comment Share on other sites More sharing options...
Macrura Posted January 22, 2015 Share Posted January 22, 2015 @everfree.. it would be good to have a definitive module that combines all of the ideas and features needed to have this working in all possible scenarios, and all different page select (asm, autocomplete, list) types.. Being able to set what fields it applies to is probably a much needed feature.. Originally the module I made was borne out of a need on a a site that i'm finishing now, a record label where the albums need to have artists added as pages... but then once you add or create a new artist you need to go right away and do some settings, like type, instruments, bio, sort name etc. so it would have been difficult to go and search for the artist you just added in order to do those settings... I have now used it on 2 additional new projects and implemented it on 3-4 other sites and i do find it pretty much indispensable.., and it will likely be in every site from now on.. 1 Link to comment Share on other sites More sharing options...
Soma Posted January 22, 2015 Share Posted January 22, 2015 I also have a version of this, just saying 1 Link to comment Share on other sites More sharing options...
thetuningspoon Posted April 21, 2015 Share Posted April 21, 2015 Macrura and I have put together a more definitive version of the editable page field which I will post to the module directory as soon as I get a chance. I agree, however, that a "page table meets page field" field is a must down the line. I have a scenario with a client right now where this would be the only ideal solution. The scenario: Client adds a company page with details about the company. Each company can have several contacts associated with it, such as a primary contact and an administrative contact. The user should be able to see some information about each contact at a glance (like a PageTable), and needs to be able to select a contact that already exists (like a Page field) but needs to be able to create and populate new contacts and have them automatically selected (like a PageTable). 4 Link to comment Share on other sites More sharing options...
Kiwi Chris Posted March 23, 2018 Share Posted March 23, 2018 This is quite an old thread, but I've just come up with a requirement for similar functionality. This would be hugely useful functionality to have. Any update on this, and compatibility with Processwire 3? I've had a look in the modules directory under field types and can't see anything? Link to comment Share on other sites More sharing options...
thetuningspoon Posted March 26, 2018 Share Posted March 26, 2018 @Kiwi Chris Did you try this? https://processwire.com/talk/topic/9857-module-page-field-edit-links/ 1 Link to comment Share on other sites More sharing options...
Kiwi Chris Posted March 28, 2018 Share Posted March 28, 2018 On 3/27/2018 at 7:53 AM, thetuningspoon said: @Kiwi Chris Did you try this? https://processwire.com/talk/topic/9857-module-page-field-edit-links/ Thanks. I hadn't spotted that module before, or maybe hadn't quite realised what it did. It's exactly what I was looking for. 1 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