Jump to content

The G

Members
  • Posts

    34
  • Joined

  • Last visited

About The G

  • Birthday 06/02/1968

Profile Information

  • Gender
    Male
  • Location
    Bucharest, Romania

Recent Profile Visitors

2,423 profile views

The G's Achievements

Jr. Member

Jr. Member (3/6)

29

Reputation

  1. Hello! I am wondering if the mime type of a Pageimage exists somewhere in the object. The only ways I could think of for getting the mime type are using PHP GD functions getimagesize($img->filename)['mime'] or, to pass around integer constants rather than string variables image_type_to_mime_type(getimagesize($img->filename)[2]) or image_type_to_mime_type((new ImageSizer($img->filename))->getImageType()) although I don't see the point in instantiating an ImageSizer.
  2. Thank you for your time. It's a good idea, it's just that the end result is not that different from a select with a single option, unless I also change the field description (which says "Choose here blah blah...") or even if I change the description. I was hoping for Inputfield properties like `showIf`, which would've been nice to support booleans in addition to string selectors*. Oh well, I don't care enough to fight the defaults, so I'll just let it be. *I guess I meant a `show` property, akin to 'required' 😄
  3. Hey, guys! From a UX point of view, it doesn't make sense to have a single option select, so I'm wondering if the following InputfieldSelect behaviour is possible: if it has only one option, make it selected and hide the select if is has more than one option, show it as usual Thank you!
  4. My issue with CKEditor 4 is that the document is saved as HTML, because multiple reasons: The saved HTML code is processed every time you wanna change it. Because is HTML, some (like me 😄) tend to go full power only to be slapped on the fingers by the security checks. Makes programmatic export/import of content less simple than how I would like it. Makes finding if a Processwire element (like an image or file) is included in a CKEditor field less simple than how I would like it. From what I read, CKEditor 5 and ProseMirror are using a custom data model. I really hope @ryan is considering one for his rich text editor!
  5. The module's output uses the same function (renderHeadContent) : <script defer src='{$this->wire('modules')->get('ProCache')->js($this->getJsFile())}'></script> One way to insert just the JavaScript URL in your array would be to check "Render Banner and Header Content Manually" and to use $modules->get('PrivacyWire')->getInlineJs() and $modules->get('PrivacyWire')->getJsFile() instead of $modules->get('PrivacyWire')->renderHeadContent().
  6. I don't think that the file you see requested comes from the module. Pro Cache should automatically merge and minify PrivacyWireUnstyled.js. Did you took out the code you added in the templates and cleared the cache afterwards? Try uninstalling the module and see if you still have PrivacyWireUnstyled.js requested. Don't forget to clear the cache after any change.
  7. Hmm, I think you didn't read the instructions carefully enough. Did you notice a "Use ProCache JS Minification (if available)" checkbox near the end of the settings? Not tried it myself, but AFAIK you don't need to mess with other settings if what you want is just ProCache minification. Try this: uncheck "Render Banner and Header Content Manually", take out the code you manually inserted into the templates and check "Use ProCache JS Minification (if available)". Regarding CSS: styles are inserted by JavaScript (PrivacyWire.js), so no module CSS file is needed. If you choose the unstyled version, the module will load PrivacyWireUnstyled.js instead leaving the styling up to you (I chose to use the unstyled version and insert the needed styles into my main CSS file, since it will be loaded on every page. Either way seem good solutions to me - the styles are only needed together with the JavaScript. Off-topic: I'd love an inline code plugin for the forum's editor.
  8. You have the "Render Banner and Header Content Manually" option in the module settings. After checking it you can insert the module generated code wherever you'd like. The script tags are generated by the folowing snippet: $modules->get('PrivacyWire')->renderHeadContent() Disclaimer: didn't tested my suggestion, this is just what I saw in the module's code. Why would you want to include both PrivacyWire.js and PrivacyWireUnstyled.js? AFAIK they only differ in including or not the module's CSS for the frontend. Including PrivacyWireUnstyled.js would only waste resources if PrivacyWire.js is included.
  9. I tried to disable or hide a "Remember me" checkbox. My HTML is <div class="field has-text-right"> <label class="checkbox"> <input type="checkbox" name="rememberme" value="<?=(int) input()->cookie->rememberme?>"> <?=__('Remember me')?> </label> </div> The code I'd prefer would be (notice the two "disabled" attributes on the label and the input) <div class="field has-text-right"> <label class="checkbox" disabled> <input type="checkbox" name="rememberme" value="<?=(int) input()->cookie->rememberme?>" disabled> <?=__('Remember me')?> </label> </div> Although I could live with only hiding it, which is what I've tried by adding data-category="functional" data-ask-consent="0" data-ask-consent-rendered="1" to the div, the label or the checkbox. And it hides them all right. The issue is that PrivacyWire does not care about innerHTML of my poor div, or about its class. I changed o.innerText=e.innerText with o.innerHTML=e.innerHTML directly into js/PrivacyWireUnstyled.js and I got my checkbox back, but without its initial class. I think it is the code at line 231 in src/js/PrivacyWire.js. I know almost no JavaScript, so start throwing tomatoes - in the priw_updateAllowedElement there is no way to let the old element live instead of copy into a new one > insert the new one in the DOM > delete the old one? Also, it feels to me that flipping between two attributes or two CSS classes should be all PrivacyWire needs to do in regard to the elements that need consent. LATER: hmm, maybe not in regard to scripts. Leaving for the coffee machine...
  10. So, excited to use the updated version as I was, there was no time for RTFM - even if there was clearly written without leading slash , I merrily entered /site/templates/modules/PrivacyWire/PrivacyWireBanner.php and BANG!, ProcessWire shouted at me for wanting to use a not allowed path (because of the resulting double slash). I'm still trembling! Since it breaks so hard, I'm wondering if the input could be somehow forced to loose the leading slashes forgotten by irresponsible people like yours truly. Sadly, I'm not well versed (yet!) in module configuration input validation/modification. Or at least, write "without leading slash" in bold letters ?
  11. Nice work! Question: I'm finding myself in need of many changes in the banner template, so I had to hook-replace the module's 'render' method. Would be useful to isolate the path retrieving code in separate hookable functions? Like this: /** * checks for a banner template alternate path * @return string the path of the banner template file */ public function ___getBannerTemplate() { return $this->wire('config')->paths->$this . 'PrivacyWireBanner.php'; } /** * checks for a javascript file alternate path * @return string the path of the banner template file */ public function ___getJsFile() { return ($this->add_basic_css_styling) ? $this->wire('config')->urls->$this . "js/PrivacyWire.js" : $this->wire('config')->urls->$this . "js/PrivacyWireUnstyled.js"; } Then, I could use it (I am using it, actually) like this (in /site/ready.php): // my front pages are all extending a FrontPage class // see https://processwire.com/blog/posts/pw-3.0.152/#new-ability-to-specify-custom-page-classes if (page() instanceof FrontPage) { $wire->addHookAfter('PrivacyWire::getBannerTemplate', function ($event) { $event->replace = true; $default_path = $event->return; $filename = pathinfo($default_path, PATHINFO_BASENAME); // my override is in /site/templates/modules/PrivacyWire/PrivacyWireBanner.php $override_path = paths()->templates.'modules/PrivacyWire/'.$filename; $event->return = is_readable($override_path) ? $override_path : $default_path; }); } Or even simpler (for me ?), those could be two new config keys, like 'alternateBannerTemplate' and 'alternateJsFile'. This would also cover the case of needing to change the header tag, so it could be dropped (just a thought, don't hit me in the head, you valiant head tag config defenders ?).
  12. In my case the Warning: Illegal offset type in /var/www/html/site/modules/ProcessBlog/ProcessBlog.module on line 917 Warning: Illegal offset type in /var/www/html/site/modules/ProcessBlog/ProcessBlog.module on line 918 messages were probably caused by the page()->outputFormatting setting being "Off", and were fixed by casting (string) on the array keys: 915 $list = array( 916 (string) $posts->title => array('published' => $qn['blog-post'], 'unpublished' => $qn['unpublished'] ), 917 (string) $comments->title => array('approved' => $numApproved, 'pending' => $numPending, 'spam' => $numSpam ), $categories->title . ' & ' . $tags->title => array('categories' => $qn['blog-category'], 'tags' => $qn['blog-tag'] ), 918 );
  13. Nice, it works beautifully. The duration. I'd like to let the user read the message for a little longer: Off-topic question: how does one make posted videos to not extend to the full container width? I used the annoying GIF above because I didn't find a way to display posted videos at their real size.
  14. After the user saves his/her choices, a confirmation message is shown for 1.5 seconds, then is removed. My contact page uses Google Recaptcha and thus it needs Google's marketing cookies to work. So, in the beginning, instead of the contact form, the page shows only a message explaining that if one wishes to use the contact form, one needs to consent to the marketing cookies. Only after/if the user consents is the form shown. I wanted to have the page refreshed after saving the choices, so the user would not need to do a manual refresh to see the changes. I did it by adding a 74 window.location.reload(true); line after 73 priw_wrapper.classList.remove('show-message'); which is the one where the confirmation message is removed (priw_showMessage(), line 73 in src/js/PrivacyWire.js) and re-rollup-ing. I could make a pull request if it seems useful. Another suggestion would be make the setTimeout delay configurable. This one is not something I needed, but it just feels right to have it configurable ?
×
×
  • Create New...