nik Posted March 5, 2013 Share Posted March 5, 2013 Page References Tab This little module adds a new tab, References, to the page editor. There it lists pages referencing the page that is being edited (title, path, field). There are also links to view or edit the listed pages (if they're viewable/editable). Only fields of type FieldtypePage are considered to be references and system fields are not listed at all (roles, permissions). It's nothing much, but as the subject has turned up a couple of times in the forums, I decided to give it a try. So watch out what you're asking! Screenshot Links Modules directory: http://modules.processwire.com/modules/page-references-tab/ GitHub: https://github.com/niklaka/PageReferencesTab 18 1 Link to comment Share on other sites More sharing options...
Soma Posted March 5, 2013 Share Posted March 5, 2013 Cool idea but isnt it too disconnected from the page fields? I have somthing similar but inside below the page select. Link to comment Share on other sites More sharing options...
nik Posted March 5, 2013 Author Share Posted March 5, 2013 I did think of other ways to approach this, but couldn't come up with anything clearly better than what I have now. Initially I was thinking of a fieldtype, but somehow I don't (yet) like the idea of a fieldtype with no data of its own. Actually, I don't quite understand what you're saying about how you've solved this yourself . Page select? Where? Still this is just one possible approach and I'm more than willing to change it to something else if someone would come up with a silver bullet or something like that. Link to comment Share on other sites More sharing options...
Soma Posted March 5, 2013 Share Posted March 5, 2013 Ahh sorry, should've seen it, I was talking about page references themself showing links to the linked pages Your's is the other way round... got it. 1 Link to comment Share on other sites More sharing options...
ryan Posted March 6, 2013 Share Posted March 6, 2013 Great idea and module Nik! This will actually be quite handy on a site I'm working on right now. Link to comment Share on other sites More sharing options...
Pete Posted March 7, 2013 Share Posted March 7, 2013 Certainly useful for larger sites and I can think of at least one that would make use of this. Link to comment Share on other sites More sharing options...
nik Posted March 16, 2013 Author Share Posted March 16, 2013 Updated version of this module just found its way into GitHub. Now there's a config option "Enabled templates" letting you choose the templates you want the "References" tab to be added to (when editing a page with those templates). If no template is chosen, "References" tab is always shown. Templates with system-flag are always skipped, like fields with system-flag have been from the beginning. 3 Link to comment Share on other sites More sharing options...
arjen Posted March 16, 2013 Share Posted March 16, 2013 Great addition nik! Really useful module since I work a lot with Page fieldtypes! Link to comment Share on other sites More sharing options...
arjen Posted May 13, 2013 Share Posted May 13, 2013 When switching templates (it doesn't matter which or of the page reference tab has been enabled) on pages I'm getting errors: Notice: Trying to get property of non-object in /home/x/x/x/site/modules/PageReferencesTab/PageReferencesTab.module on line 65 Notice: Trying to get property of non-object in /home/x/x/x/site/modules/PageReferencesTab/PageReferencesTab.module on line 71 Warning: Cannot modify header information - headers already sent by (output started at /home/x/x/x/site/modules/PageReferencesTab/PageReferencesTab.module:65) in /home/x/x/x/wire/core/Session.php on line 358 Warning: Cannot modify header information - headers already sent by (output started at /home/x/x/x/site/modules/PageReferencesTab/PageReferencesTab.module:65) in /home/x/x/x/wire/core/Session.php on line 359 Warning: Cannot modify header information - headers already sent by (output started at /home/x/x/x/site/modules/PageReferencesTab/PageReferencesTab.module:65) in /home/x/x/x/wire/core/Session.php on line 360 Any pointers why this error might occur? It does save the chosen template on the page. I'm running 2.3.0. 1 Link to comment Share on other sites More sharing options...
adrian Posted May 13, 2013 Share Posted May 13, 2013 I just installed this module and got exactly the same errors. 1 Link to comment Share on other sites More sharing options...
arjen Posted May 13, 2013 Share Posted May 13, 2013 Line 65 seems to include a single &. Changing this to && doesn't matter. Link to comment Share on other sites More sharing options...
Soma Posted May 13, 2013 Share Posted May 13, 2013 Works just like a charm here. Link to comment Share on other sites More sharing options...
Soma Posted May 13, 2013 Share Posted May 13, 2013 Line 65 seems to include a single &. Changing this to && doesn't matter. Nothing wrong there, this is bitwise operator http://www.php.net/manual/en/language.operators.bitwise.php Ther error says $this->editedPage is not an object... so maybe even the line before fails for you for unknown reasons $this->editedPage = wire('pages')->get((int)$this->input->get('id')); can you try replace #62 with echo wire('pages')->get((int)$this->input->get('id')); exit; And refresh page and see what output? 1 Link to comment Share on other sites More sharing options...
arjen Posted May 13, 2013 Share Posted May 13, 2013 I've seen the bitwise operates before, but I don't totally understand this soma. I've narrowed it down a little bit more. Changing a template which doesn't result in the deleting of any fields doesn't throw an error. Replacing line 62 with your code results in an empty page (double checked no output at all). It seems getting stuck at: http://domainname.com/processwire/page/edit/saveTemplate I'll try and disable some other modules which might be infering with this one. Link to comment Share on other sites More sharing options...
Soma Posted May 13, 2013 Share Posted May 13, 2013 Ah sorry missed the change temple part... now it's more obvious a bug 1 Link to comment Share on other sites More sharing options...
arjen Posted May 13, 2013 Share Posted May 13, 2013 No worries. It's getting late here. I will try to find out more tomorrow. Link to comment Share on other sites More sharing options...
Soma Posted May 13, 2013 Share Posted May 13, 2013 The fix would be easy to add this before line #62 if(!$this->input->get('id')) return; 2 Link to comment Share on other sites More sharing options...
nik Posted May 13, 2013 Author Share Posted May 13, 2013 Thanks @arjen & @adrian for the report. And thanks @soma for giving the right solution . It definitely was a bug in this very module. I've updated the module to check id has been given as a GET parameter before using it to get the page being edited. This seems to solve the problem you guys were facing, just like soma said. New version is in GitHub and version number has been updated in the modules directory as well. @arjen: Soma was right also regarding that bitwise-and (naturally ). That line, and two similar ones elsewhere, checks if the template has the system flag set. Property 'flags' of a template is a bit field where there's possibly more than one flag (bit) set at a time. So it wouldn't be correct for example just to see if the flags value equals to the value of system flag, but it has to be done using a bitwise operator.Sidenote: actually in this very case there's only the system override flag that could co-exist with the system flag, but still that's the correct way of checking if a flag has been set . 3 Link to comment Share on other sites More sharing options...
arjen Posted May 14, 2013 Share Posted May 14, 2013 Nik, I've updated the module and it works great! Thanks for updating the module. Link to comment Share on other sites More sharing options...
bcartier Posted July 23, 2013 Share Posted July 23, 2013 I love this module too! I noticed that it doesn't seem to list Page References created inside Repeaters. That would be a nice addition. -Brent 1 Link to comment Share on other sites More sharing options...
nik Posted August 7, 2013 Author Share Posted August 7, 2013 @bcartier: Sorry for the delay, I've been just catching up after being four weeks (almost) completely away from the computer. You're right, fields inside repeaters were not handled at all. But now they are, as I've just pushed a new version of the module to GitHub. Seems to work ok. 1 Link to comment Share on other sites More sharing options...
Macrura Posted February 5, 2015 Share Posted February 5, 2015 @nik, great and essential module, using it all the time; Also learned from your code and was able to create some other modules that add their own tab. One question though - is it possible to add the tab before the view link? Then when you click it, the buttons for save would be able to stay below the tab frame.. i guess it would somehow need to append the tab before the save button and view links... Link to comment Share on other sites More sharing options...
netcarver Posted February 5, 2015 Share Posted February 5, 2015 @Macrura I think this might be covered by this issue on the repo. That linked page also shows how to fix the issue. 1 Link to comment Share on other sites More sharing options...
Macrura Posted February 5, 2015 Share Posted February 5, 2015 @Macrura I think this might be covered by this issue on the repo. That linked page also shows how to fix the issue. @netcarver - thanks, yes, this fixed it! 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