Jump to content

PWaddict

Members
  • Posts

    999
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by PWaddict

  1. @ryan will you consider to add an option to populate the loading="lazy" attribute to iframe tags? Although with a simple hook like below we can get the job done but it would be great if we can have it available on the module. $wire->addHookAfter('Page::render', function(HookEvent $event) { if ($this->wire('page')->template->name != "my-content") return; $event->return = str_replace("<iframe ", "<iframe loading='lazy' ", $event->return); });
  2. Adding the native lazy load loading='lazy' on the 381 line of TextformatterVideoEmbed.module doesn't seem to lazy load the iframe. I can see the attribute on the page's code that is injected but all the YouTube scripts are loading on the initial page load even through the embed video is about 2000+ pixels from top. What am I missing??? EDIT: All the Chromium browsers have a very large threshold. On Mozilla the threshold is much lower and the iframe gets loaded when you're getting close to it at about 500px.
  3. Thanks for the info @Juergen One last question: If an already verified user (programmatically or not) change their email, will the user receive a new activation link on their new email to verify it?
  4. Hi @Juergen, I have 2 quick questions (I haven't installed the module yet). Is the module stable or beta? On the module page info it says "v1.3.7 Stable" but on the description says "This module is early Beta stage - so be aware of using it on live sites!" If I create users programmatically with the proper role will those accounts require verification / activation links to function normally?
  5. I'm currently having this issue and fixed it with this hook: /** * CSS: Hide the empty height space of inputfield columns when they stacked (mobile / tablet) on ProcessPageEdit * */ $wire->addHookAfter('ProcessPageEdit::execute', function(HookEvent $event) { $event->return .= " <style> @media only screen and (max-width: 767px) { .maxColHeightSpacer { display: none; } } </style>"; }); EDIT: It seems my hook breaks the image uploading. I read somewhere to enable the UIkit uk-width classes on AdminThemeUikit module and that is actually working.
  6. You're right. The problem is on my side. I have another hook Errormessage::render to add the font awesome icon on the errors. Problem solved.
  7. I'm 100% sure. I checked it mutliples times and no class added at all. Only with the hook I can see the uk-width-1-1 there. Maybe the module still having issues with the namespace?
  8. Sorry, but this seems that it doesn't work. No class added.
  9. Thank you @Juergen Here is the final code in case anyone wants to use the grid (UIkit) on a checkbox: $checkbox = new \FrontendForms\InputCheckbox('checkbox'); $checkbox->setLabel('My Checkbox Label'); $checkbox->setRule('required')->setCustomMessage('My custom required text'); $checkbox->getErrorMessage()->setAttribute('class','uk-width-1-1'); // Add uk-width-1-1 to prevent the text displayed as part of the grid $checkbox->getFieldWrapper()->setAttributes(['data-uk-grid', 'class' => 'uk-grid-small']); $checkbox->prepend('<div class="uk-width-auto">'); $checkbox->append('</div>'); $checkbox->getLabel()->wrap()->setAttribute('class', 'uk-width-expand'); $form->add($checkbox);
  10. Hey @Juergen I need to make the checkbox field look like this: <div class="uk-grid-small" uk-grid> <div class="uk-width-auto"> <input id="checkbox" class="uk-checkbox" type="checkbox"> </div> <div class="uk-width-expand"> <label for="checkbox">Checkbox Label</label> </div> </div> But it's not possible (I think) without first use the method $form->appendLabelOnCheckboxes(true); but it seems it doesn't do anything at all.
  11. Thanks a lot @Robin S your code works great. I was trying on saveReady hook too using the below code but couldn't make it work properly. I wasn't using foreach loop as the image field I was testing it accepts only 1 image. $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->object->getPage(); if ($page->template->name != "my-page-template") return; if($page->image->custom_image_field == "") { $page->addStatus(Page::statusUnpublished); } });
  12. @Robin S Nice hook. I'm trying to unpublish the page if the custom field is empty but it's not working. if(!$inputfield->value) { $page->addStatus(Page::statusUnpublished); } Any idea how to accomplish that?
  13. CroppableImage3 1.2.0
  14. I ended up using a custom image field as required for the image description to add some notes too. With the following hook on ready.php, I just copy the custom image field description value to the native description field so it can be displayed as alt attribute on RTE images. The native description field no need to be displayed in the editor. It can be as 0 on "Number of rows for description field?" $wire->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template->name != "my-template") return; foreach($page->images as $image) { $image->description = $image->image_description; } });
  15. If that native description field is actually an inputfield then I guess that might work but currently there is no point to even try anything for now as the images will be uploaded via ProcessPageEditImageSelect and there is a serious issue with it.
  16. Hello! I would like to have file/image description required. Is it possible? Or should I create a custom field for it? But then how can I output alt attribute value on a TinyMCE image?
  17. Hello! Is there any way to force the recreation of the webp variation when the crop is edited?
  18. Hello! I trashed a page and when I checked the Trash to restore it I noticed that there is no "restore" button on it. Not even a "view" button. There is only "edit" and "move". If I set the page to "Unpublished" while on trash only then the "view" button appears but still there is no "restore" button at all. The page belongs to a template that is used for children. I'm using a brand new ProcessWire installation 3.0.244. Also, upgraded it to 3.0.245 and the issue remains. I do not have that issue on a website with 3.0.229. EDIT: While I'm using 3.0.245 now, I created a new children page and then trashed it and the "restore" / "view" buttons are now visible.
      • 2
      • Like
  19. Thank you @Juergen You accidentaly placed the old Hooking example 2 on the docs which now the font awesome icon displayed always even if there are no errors. Replace it with the above hook which works properly.
  20. Yep, now this hook works: $wire->addHookAfter('Label::renderAsterisk', function(HookEvent $event) { $event->return = '<span class="myAsterisk">+</span>'; }); Please fix Errormessage::render too.
  21. I'm testing on localhost with ProcessWire 3.0.244.
  22. I'm testing it on a brand new website and my init.php doesn't have any other hook. If I change the hook to Page::render it works so it seems it's not a PW issue. <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); /** @var ProcessWire $wire */ /** * ProcessWire Bootstrap Initialization * ==================================== * This init.php file is called during ProcessWire bootstrap initialization process. * This occurs after all autoload modules have been initialized, but before the current page * has been determined. This is a good place to attach hooks. You may place whatever you'd * like in this file. For example: * * $wire->addHookAfter('Page::render', function($event) { * $event->return = str_replace("</body>", "<p>Hello World</p></body>", $event->return); * }); * */ wire()->addHookAfter('Form::render', function ($event) { $return = $event->return; $return = str_replace('<span class="asterisk">*</span>','<span class="myAsterisk">+</span>', $return); $event->return = $return; });
  23. I tried the new hook on both init.php and ready.php but still not working. wire()->addHookAfter('Form::render', function ($event) { $return = $event->return; $return = str_replace('<span class="asterisk">*</span>','<span class="myAsterisk">+</span>', $return); $event->return = $return; });
  24. No, I'm talking about the TinyMCE autolink plugin. You can find it on the Input tab.
×
×
  • Create New...