Jump to content

owzim

PW-Moderators
  • Posts

    490
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by owzim

  1. This is how I've done it, hooks to the rescue. Clean. $this->addHookProperty('Language::code', function(HookEvent $event) { $lang = $event->object; $event->return = $lang->name === 'default' ? 'en' : $lang->name; }); So now you can access it as a property of languages. $user->language->code;
  2. Hi, unfortunately I currently have little resources for that. You are welcome to open a PR though.
  3. The rendering ($page->render()) is taken care of elsewhere.
  4. That is also an option I thought about, but this is for a module I am creating and I don't want users of that module to jump through those hoops.
  5. I want to render pages without the need of a template file. 404s still work.
  6. Thanks, ProcessPageView::pageNotFound is definitely the right spot, I came up with this method, don't know if it has any access rights implications: public function hook_ProcessPageView_pageNotFound(HookEvent $event) { $page = $event->arguments('page'); $page->template->filename = 'path/to/existing/file'; if ($page->viewable()) { $event->return = $page->render(); $event->replace = true; } } Page render actually outputs something, because I hook into it. But just not with a template file.
  7. Thanks, unfortunately this gives my only ''access not allowed" as a $reason, so if I would overwrite the behavior via hook, based on that, I would mess with all kinds of access management.
  8. Hi, is there a way to change that behavior? Can I hook into that somehow? Thanks!
  9. Hi, I ran into this issue a while back and remember fixing it but haven't pushed to master. I will have to look into it. I think it might work on the dev branch, not sure though. Edit: yup it's fixed on the dev branch. I use it on a production site, but I appreciate any quick testing in your environments, so that I can merge it into master, if no further issues arise. Thanks for reporting!
  10. Works now, thanks a lot @Mike Rockett for reacting so fast.
  11. Thanks for the update @Mike Rockett. After the update: without trailing delimiters (foo;bar) I get: ProcessJumplinks: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '-0001-11-30 00:00:00' for column 'date_start' at row 1 With trailing delimiters (foo;bar;;) I get: Notice: Undefined index: date_end ProcessJumplinks: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '-0001-11-30 00:00:00' for column 'date_start' at row 1 This only happens if I input more than one line. If it's only one line, it works. If it's only one line, both values separated by the delimiter land in the source field, destination stays empty. Is there a reason, why you rolled your own CSV parser instead of using str_getcsv?
  12. Hi @Mike Rockett, I can't get the CSV import on 1.5.46 to work: Tried: foo,bar baz,qux foo;bar baz;qux foo,bar,, baz,qux,, foo;bar;; baz;qux;; In the cases without trailing delimiters I get: Notice: Undefined index: source Notice: Undefined index: destination ProcessJumplinks: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '-0001-11-30 00:00:00' for column 'date_start' at row 1 With trailing delimiters, the jumplinks are created but source is empty and destination is a string: page:1. I made sure, no empty lines are present.
  13. A classic case of RTFM %#~* Thanks @Mike Rockett, this is brilliant.
  14. Thanks @Mike Rockett, the implicit option with {all} will suffice. I haven't dug too deep into all the options, but it would be great if mapping could be done without collections: source: project?id={someCustomField} dest: projects/{someCustomField} So that someCustomField would be a field of projects/ child pages, like $pages->get('/projects/')->children('someCustomField={value}'); This way one could simply migrate the ids of the old site over. source: project?id={oldID} dest: projects/{oldID} $pages->get('/projects/')->children('oldID={id}');
  15. Hi @Mike Rockett, this module is awesome, thanks! I have this collection thing going on: example source: project?id=1&foo=bar So I set it up like this: source: project?id={id}&foo=bar dest: projects/{id|projects} Works! But, when &foo=bar is omitted this does not work: project?id=1 How to make anything after id optional, I tried brackets, but it does not work. source: project?id={id}[anything here, but optional] Thanks!
  16. Often times, the RewriteBase rule is the source of a server error. Try tweaking that.
  17. Got it working. The source of the misbehavior was, that I set the string somewhere else afterwards, like so: $field->options = $optionsString; Doh! The side effects are still very strange though, and interesting that the field class even uses it somehow.
  18. I have this string of options: option1|Option 1 option2|Option 2 option3|Option 3 I add the options string like mentioned before: $manager = new \ProcessWire\SelectableOptionManager(); $manager->setOptionsString($field, $options, true); The result is this: If I add it with IDs 1=option1|Option 1 2=option2|Option 2 3=option3|Option 3 The result is this: In both cases within the field settings detail tab, everything looks OK, and the preview shows the expected output: Also: Changing the override argument to false, does not affect this behavior. In the database, everything looks fine: Debugging $inputfield->options in FieldtypeOptions:getInputfield, the options array looks fine as it should: Three items with an id, value and title. This is VERY weird: If I replace the return value in FieldtypeOptions:getInputfield // original return $inputfield; // replace $fs = $this->modules->get('InputfieldFieldset'); $fs->add($inputfield); return $fs; I get the correct output, in the given Fieldset: This suggests that the misbehavior is happening somewhere else? If I create it via admin, everything works as expected, only the titles show. Any help? Thanks!
  19. The additional settings will be very useful, thanks. The core inclusion of Parsedown and your module renders my module from 2014 redundant. I'll take it off.
  20. On Vimeo: What Comes Next Is the Future (2016)
  21. @Mike Rockett interesting content already. Would be cool if you implemented some sort of notification system, email, twitter or whatev, so one doesn't miss new posts, without visiting the site manually.
  22. This is what the editor sees: This is what I see: There just one thing different about Standort (Location) and Veranstaltung (Event) compared to Bezirk (District): Both can be in multiple places within the site structure, so that one has to select a parent before creating (this is where only I get to): i.e. all locations have Calendars, which hold the Events. Access management is set to No to all of these. ProcessWire 2.7.2 Thanks!
  23. Yeah, well ... Thanks @Klenkes! That did it, wasn't aware of that. Sometimes I chose the complicated route over trying more obvious options. Those RTEs are dinosaurs anyway, my next PW installation will have Repeater Matrix and Ace-Fields only.
  24. Hi, I tried to disable it in my site/modules/InputfieldCKEditor/config-body.js CKEDITOR.editorConfig = function( config ) { config.plugins.image = 0; config.plugins.pwimage = 0; console.log('CKEDITOR.editorConfig executed'); }; I made sure that the function is executed by that console.log call, but the image button is still there. Thanks! Edit: Removing the plugin like suggested here, doesn't do it either: CKEDITOR.editorConfig = function( config ) { config.removePlugins = 'image,pwimage'; // OR: config.removePlugins = 'pwimage'; // OR: config.removePlugins = 'image'; };
×
×
  • Create New...