Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Such calls should never been put in the init.php (well you have to be careful). If you use render inside your template to render partials for example the init will get called each time. Anyway you should add your hook in a autoload module. See HelloWorld.module.
  2. You can't I guess. PW needs those helper classes. After all it's never intended to be used for front-end. So expect some compromises.
  3. RT @agrioTinus: Processwire - The trailer (unofficial): http://t.co/dj6EidfscU via @YouTube

  4. You can also search repeater direct and get the page they're on. Look how the repeater template is named and use that $selector = "template=repeater-chalet, ..."; then on the result $chaletpage = $repeaterpage->getForPage();
  5. Something like when you click on "more" on the cheatsheet items -> ie. http://cheatsheet.processwire.com/pages/built-in-methods-reference/pages-find-selector/ ?
  6. OT: Then you don't think my PW cheatsheet filter is good and right? BT: I don't know what the problem with sorting should be here is (or maybe I don't understand your words). Ohhh you can do all sort of crazy thing. $pages->find("template=basic-page")->find("title*=solala")->find("featured=1"); $pages->find("template=basic-page")->filter("title*=solala"); $arr = $pages->find("template=basic-page"); $arr2 = $pages->find("template=user"); $arr->add($arr2); $res = $arr->find("title*=blabla"); $res->sort("-field");
  7. I'm not sure what that should be for solving the problem. Anyway before it gets out of hand. $templates is a template system variable, you empty it on first line... If then you could do such a task like: $tpls = $templates->find("name=basic-page|sitemap"); foreach($tpls as $t){ $t->fields->add("myfield"); ... } You can also do this $t = $templates->get("basic-page"); $t->fields->insertBefore( $fields->myfield1, $t->fields->images ); $t->fields->insertAfter( $fields->myfield2, $t->fields->images ); $t->fields->save();
  8. I find it strange that a CMS has no link (or link list) feature. After all it's about links. I also would be many times in need for a repeater style slick link field. Thing is it can get really tricky really fast to build such a module especially if you need to be able to either enter url, select a internal page, have attributes like open in new window etc. Then maybe need something to enter linktext (also multilanguage), and then maybe even the urls should be different for each language. I solved it with either - repeater - just have them make the list in wysywg - markdown textarea (kinda hard for clients) If I'm lucky and there's only one link required, I solved it using a text language field, a page reference, and a url field. And handle it on template output. Maybe we can sponsor a link (list) tool.
  9. How about http://modules.processwire.com/modules/page-references-tab/ If you reference one page with another (with a page field) why do you need to reference back? You can easily use the reference in both directions.
  10. url is a method and not a property. You'd need to hook Page:path to change url.
  11. Just to add to the confusion. - You can make the title field not required in template context. - You can set a template to not include global fields (advanced settings) So you could remove title for that template but still have title global.
  12. I have no idea to be honest. Works fine here. But I'm not using InputfieldImage but InputfieldFile.
  13. You can easily make the module your own and add or change things. This would be totally the way to go here I think. I think Ryan don't really have plans to go on with the module and was more an simple example how to build a simple form using a template. --- With hooks if interested read on (little tricky to get it done) --- Removed code. Screw it , it won't work cause how the module is built. It won't allow to easily hook the form processing that happens in the ___render(). It's better after all to either change the module to your needs or add honeypot support and do a pull request maybe.
  14. @lostkobrakai, you many read this thread again as this has come up multiple times (not only in this thread) from around here https://processwire.com/talk/topic/2089-create-simple-forms-using-api/page-5 or just scan the whole thread as it's full of this. There's also some gist examples https://gist.github.com/somatonic/5236008
  15. Plz file an issue on github. Better for Ryan to spot soon..
  16. Your hook and method has a lot wrong. If this all would work, then you would hook into Inputfield::render() and not Inputfield::renderValue(); And a hook to do what you wanted would look more like this: function hookAppendClassName($event) { $className = " mygrid"; $classes_array = $event->object->getParent()->getClasses(); $classes_array = array_merge($classes_array, array('item' => $classes_array['item']." ".$className)); $event->object->getParent()->setClasses($classes_array); } But this is not possible. When a inputfield is rendered in the inputfieldwrapper, the classes and markup is already set and you can not overwrite it at that moment in time. I also was looking into this and by chance I found a line of code in latest dev, that seems to be added recently. InputfieldWrapper rendering method looks for a $inputfield->wrapClass, I didn't know was there. So you can now simply do this: $field = $modules->InputfieldText; $field->label = "Name"; $field->wrapClass = "mysuperlol-col1--wonder__toootooo"; ...
  17. If you turn off output format, you don't need getUnformatted(), cause you already then have a unformatted timestamp. And yes no need for integer for timestamp.
  18. Well, it works and does fallback to default, but I think not in 2.4 stable. https://github.com/ryancramerdesign/ProcessWire/issues/292
  19. RT @processwire: ProcessWire now comes with a multi-language site profile. Plus: language files now split by site & core– https://t.co/pHAj…

  20. Have you installed the new fieldtype FieldtypePageTableExtended? And then created/changed the field with "PageTableExtended" ? It's a new field.
  21. @ryan. Not a lot of demand? What planet do you live Well, everytime this comes up it get's many likes. My post just got 7 likes. I and many others are waiting for versioning/drafts since a long time. Thing is that it was on the roadmap all the time, so many of users are not asking for it again and again cause it's already.. well "ordered". I agree that it might not be always needed, and I see that this is not a quick implementation (I wouldn't know how in PW this should be designed). Maybe PW just isn't designed and capable for such a feature. And also it can lead to confusion if not implemented right. And all that comes with it, all correct. But I think it's a feature many are waiting for.
  22. There's no sanitizer username in the docs https://processwire.com/api/variables/sanitizer/ If you mean the cheatsheet.processwire.com yes it's still there, but it's because it's not maintained at the moment.
  23. @deprecated, use pageName instead. This is since 2.4. /** * Format required by ProcessWire user names * * @deprecated, use pageName instead. * @param string $value * @return string * */ public function username($value) { return $this->pageName($value); /* $value = trim($value); if(strlen($value) > 128) $value = substr($value, 0, 128); if(ctype_alnum(str_replace(array('-', '_', '.', '@'), '', $value))) return $value; return preg_replace('/[^-_.@a-zA-Z0-9]/', '_', trim($value)); */ }
  24. Why would you "hook" into render or renderTable when you're extending the modules? If you wanted to hook into InputfieldPageTable you wouldn't need to extend it. Since you extend the inputfield you just overwrite the render method from the parent, or use its render method. public function ___renderTable(array $columns) { if($this->renderLayout) { $out = $this->attr("value"); // your method } else { $out = parent::___renderTable(); // InputfieldPageTable method } return $out; }
×
×
  • Create New...