Jump to content

elabx

Members
  • Posts

    1,479
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by elabx

  1. Well, had to do this now for including a privacy policy link in a formbuilder label ? $wire->addHookAfter("InputfieldCheckbox::render",function($event){ $field = $event->object; $output = $event->return; $policyUrl = $this->pages->get("name=privacy-policy")->url; if($field->name == "privacy_policy"){ $output = str_replace("privacy policy","<a href='{$policyUrl}'>privacy policy</a>", $output); } $event->return = $output; });
  2. Hahahahaha, early morning support, sorry guys
  3. Use double quotes!
  4. I got it to work like this! https://jsfiddle.net/elabx/vysjwp01/
  5. Check this post from Ryan:
  6. I would try using this function: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module#L432 Repeaters items are actual pages that have to be created, hence when you are iterating the field in your code counts 0 repeaters, because no repeaters exist!
  7. Is there any other place in the code where you actually create the repeater items themselves? Maybe that's missing.
  8. Mmm, I don't think this will be as straighforward, I think this is all performed in javascript: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js Maybe override the whole CKEditor module (copy the whole module to site/modules) and rewrite the line where the img tag is created, which i think is here: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js#L210
  9. For some simple ad banners with click measurment, what I have done is using Google Analytics as measurement of the click events, i feel it just offers A LOT more out of the box. Let's you filter by a bunch of things, present data in a lot of ways, make reports in Google Design Studio, etc. Though in all honesty, don't know how it compares to the previous solution.
  10. I was surprised to find out that these are not WireArray! https://github.com/processwire/processwire/blob/master/wire/core/FilenameArray.php
  11. Make the user page have a page reference field that lets you create new lists. This would let you either creat all lists in the website under a central page, or with a little hook work have each list of lists living under the user. Let the page reference field include this pages through the selector that return the selectable pages. My first though would be to use another page that relates each list-game with the extra info, you could probably add a hook that automatically adds a page somwhere which holds all this extra fields. Could be something like: - User -- Lists --- List 1 (holds a page reference field to all games) ---- Game 1 (for each game in the list parent field, a page here exists, holding extra fields that can be custom for this particular user) ---- Game 2 All possible with selectors and i think the owner selectro could help here: http://processwire.com/blog/posts/processwire-3.0.95-core-updates/ Doable out of the box with the page reference fields. This are just my first thoughts, maybe someone has a more elaborate solution or sees an error in my conception.
  12. Wow! Amazing educational answer, thanks a lot, this kind of conversation really helps anyone move forward, thanks for your dedication!
  13. Hi! Wanted to share this and ask for opinions: I see a lot of regex approach to finding/changing links but the DOMDocument class seems very useful, is there a downside to this? Any other comment to improve this? ? (naming convention, code style?) <?php /** * Textformatter to output local links inside RTA textarea fields, as their language equivalents * by Eduardo San Miguel * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class TextformatterLanguageLinks extends Textformatter implements Module { public static function getModuleInfo() { return array( 'title' => "Multilanguage links", 'version' => "100", 'summary' => "Textformatter to output local links inside RTA textarea fields, as their language equivalents", 'author' => "Eduardo San Miguel", 'requires' => array( "PHP>=5.4.0", "ProcessWire>=2.5.28" ), 'icon' => 'languages' ); } public function format(&$str) { $dom = new DOMDocument(); $dom->loadHTML($str); $tags = $dom->getElementsByTagName('a'); foreach ($tags as $tag) { $path = wire("sanitizer")->path($tag->getAttribute("href")); if($path){ $possiblePage = wire('pages')->get($path); } else{ continue; } if($possiblePage->id){ $langPageUrl = $possiblePage->localUrl(wire("user")->language); } //If empty? if($langPageUrl){ $str = str_replace($tag->getAttribute('href'), $langPageUrl, $str); } } } } Edit: Already found bugs because I wasn't sanitising the assumed path in the href attributes.
  14. The $page inside the Hannah code should refer to dev_button_repeater item, so you can search where it belongs to like this: wire('pages')->get(preg_replace("for-page-",$page->name)); That should return the dev_repeater item of the iteration. Thoug don't have very clear how you are using the hannah code. Maybe like this it would work? Use the parent repeater's image if attr is data-image and no value is set. [[data attr="data-image"]] Set a custom data attribute: [[data attr="data-example" value="Something something"]]
  15. <?php foreach($page->dev_repeater as $repeater) { $image_field = $repeater->image_field; foreach($repeater->dev_child_repeater as $url) { $url->hidden_field = $image_field->url; } } ?> I´m guessing something like this should be working right?
  16. Yes, this should be doable! https://github.com/ryancramerdesign/ProcessHannaCode (Check PHP Usage Notes) If I understand the docs correctly, the $page variable context will be the repeater page where the image field is.
  17. Is there a way to add an extra action to the ProcessPageEdit button? I tried calling $inputfieldSubmit->addActionLink() but get a weird result (image below), then I noticed that ProcessPageEdit seems to be rendering this options without the module's render methods? Getting this when adding an option through a hook to the InputfieldSubmit object of the edit form:
  18. Well now it does perfectly! But I don't know how I got yesterday to a bunch of 404 pages. If I come accross the situation again I'll let you know.
  19. Hi! @Mike Rockett the documentation pages for Jumplinks seem to be down, will you upload them somewhere else again?? Then again, thanks for this awesome module. EDIT: Whoops, right here: https://jumplinks.rockett.pw/
  20. Sounds to me like a good option is the RuntimeMarkup module, so you can basically render whatever you want in the inputfield, and add the necessary javascript to do the whole copy-paste to clipboard.
  21. So you didn't integrate the shop into the PW website in the end? (I remember you were looking for a solution). What stopped you from doing it? Just curious here ? Great work!
  22. Anything on the error log on site/assets/logs/error.txt?
  23. That looks like some hipster god stack haha
  24. Ar the fields set to save single pages?
  25. Hi August! I had a bit of a hard time understanding your post, but I think you are trying to get pages with has a page field filled, then, assuming your field is called group: $selection = $pages->find("group!=''"); It's very rare to use SQL statements in ProcessWire unless you are thriving for extreme optimizations.
×
×
  • Create New...