-
Posts
11,182 -
Joined
-
Last visited
-
Days Won
372
Everything posted by adrian
-
Minor, but important update today. This morning's commits to PW 2.4.17 made the password field required for new users, which broke this module when using the automatically generated password option. I just submitted a fix for this. Please let me know if you have any troubles.
-
Strategy for flexible content types in a template
adrian replied to jordanlev's topic in Getting Started
There is a new field type (PageTable) in the dev version of PW which will be released as 2.5 probably in the next week or two. There isn't much documentation on it yet, but there is already a cool extended version of it that will help you to visualize how it can work for exactly the scenario you are talking about: https://processwire.com/talk/topic/7459-module-pagetableextended/ -
There was some discussion about Sir Trevor, starting at this post: https://processwire.com/talk/topic/4189-flexibility-in-page-design/?p=46536
-
I guess I am mixing purposes a bit here - your goal was to style the output exactly as it will appear on the frontend, but I guess I am looking more for replicating the ease of editing that repeaters have. Maybe I'll make a different extension for PageTable that works more that way. Maybe not worry about the ajax saving and just use the page save to save each of PageTable components. I'll mull over it for a bit.
-
Awesome! - only one suggestion - it would be great to have text fields editable inline, with ajax save - might be beyond the scope of what you want, but I think it would be cool
-
Yeah, it won't go and download it, but it will tell you if it is available to install. I mostly just used $this->modules->get to check, but that didn't seem to work for inputfields (eg InputfieldSelectMultipleTransfer) and inputfield classes (eg CKEditor - when it was a separate module).
-
These might come in handy: $this->modules->isInstalled() $this->modules->getInstall() I used these in Migrator for detecting if third party modules are installed and if they are available to install.
-
Fatal error is gone, but I am getting a gazillion of these: Notice: Undefined variable: row in /site/modules/ProcessChangelog/ProcessChangelog.module on line 970 Notice: Undefined variable: template_name in /site/modules/ProcessChangelog/ProcessChangelog.module on line 971
-
It's mentioned here: http://processwire.com/api/include/ although I think also somewhere else that I can't find right now.
-
Hi @onionradish and welcome to the forums. You need to make use of wire('page') etc when using inside a function.
-
Hey teppo, Minor, but fatal, bug for you. If you have Template checked under Visibility Settings and there are some entries in the log that refer to a template which has since been deleted from the system, you get a: Fatal error: Call to a member function get() on a non-object in /site/modules/ProcessChangelog/ProcessChangelog.module on line 765 Obviously just need a check to make sure that the template still exists. Thanks!
-
Obviously a much better approach from Soma! so I definitely don't deserve a "Solved" on this one Of course my original code snippet didn't exclude other fields, but I was thinking something along the lines of checking the name of the field before proceeding - just didn't get that far when posting in a rush yesterday
-
Extending module, problem with config
adrian replied to MadeMyDay's topic in Module/Plugin Development
@MadeMyDay - I love what I think you are doing with this module - I was having an idea just like this the other day - can't wait to see what you come up with -
EDIT: Ignore this idea completely - soma's solution hooking into InputfieldButton::render is obviously a much better idea I don't have time right now to put a working solution together, but you'll want to hook into InputfieldPageTable::render and do an $event->replace = true and then scan the content and strip out the add new button. You could do that with a regex, eg: function strip_selected_tags_by_id_or_class($array_of_id_or_class, $text) { $name = implode('|', $array_of_id_or_class); $regex = '#<(\w+)\s[^>]*(class|id)\s*=\s*[\'"](' . $name . ')[\'"][^>]*>.*</\\1>#isU'; return(preg_replace($regex, '', $text)); } or perhaps more efficiently with domdocument's removeChild() - eg: http://stackoverflow.com/questions/12903483/remove-a-domnode-with-a-certain-class-in-php Something like this: <?php class RemoveAddButton extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Conditionally Remove Page Table Add Button', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldPageTable::render', $this, 'removeButton'); } public function removeButton(HookEvent $event) { $event->replace = true; if(count(array)==0){ $event->return = regex or removechild here to remove button from original $event->return; } } Hope that gets you going. Otherwise, I'll put something working together for you tomorrow.
-
Remember though that srcset is not available that widely available just yet: http://caniuse.com/#search=srcset So that link I sent you to mentions the picturefill polyfill that you'll need to get going with it now: http://scottjehl.github.io/picturefill/#getting-started
-
This is not really PW related. Some googling should get you going. https://developers.google.com/maps/tutorials/customizing/custom-markers
-
Not specifically about retina images, but rather responsive images in general and the polyfill for the new standard: http://css-tricks.com/video-screencasts/133-figuring-responsive-images/ Includes mention of providing a specific 2x version of images.
-
Here is a configurable version. Choose the desired parent page from the module settings: https://gist.github.com/adrianbj/437e3945e9d774f5a67e
-
I think you added the solution to the wrong post By the way, I updated my post to make it a complete working module for you! Of course this module could be extended to make the parent page selectable via the module's config settings.
-
Use this simple module. Just replace the xxxx with the ID of the root page you want to start from. EDIT: ignore this version and use the configurable one posted on gist: https://gist.github.com/adrianbj/437e3945e9d774f5a67e class ChangeImageSelectParent extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Change Image Select Parent', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('ProcessPageEditImageSelect::execute', $this, 'changeParent'); } public function changeParent(HookEvent $event) { $event->replace = true; $event->return = str_replace("rootPageID: 0", "rootPageID: xxxx", $event->return); } }
-
The multiple row line height is new in a fairly recent PW dev version.
-
There are lots of PHP libraries for creating PDFs dynamically. mPDF seems pretty popular these days: http://www.mpdf1.com/mpdf/ Also check out this guide for using it with PW: https://processwire.com/talk/topic/7025-how-to-create-pdfs-with-pw-and-mpdf/
-
Show unpublished page to logged out users
adrian replied to Torsten Baldes's topic in General Support
I haven't used it, but there is also this module that might suit your needs: http://modules.processwire.com/modules/process-page-draft/ -
Repeater, pages selector and "connected data"
adrian replied to moonwhaler's topic in General Support
I agree that the PageTable field is not perfect in this sense, but there is a way around this: Set up the Automatic Page Name Format option for the PageTable field and then go to the title field and adjust the settings in context of the template being used for the PageTable field content and uncheck required and set it to hidden. So it's still there, but at least it's not in the user's way. This way the page can be published without the title field. Hope that helps a bit. -
@blad - what version of PW are you running? Looks like there was a bug in 2.4: https://processwire.com/talk/topic/7315-change-loop-order-without-reordering-items/?p=70460 And scroll down from there for teppo's response: https://processwire.com/talk/topic/7315-change-loop-order-without-reordering-items/?p=70467 Hope that helps and you don't get that error in the dev version of PW. If you do, then maybe submit an Issue on Github and reference that thread and this one.