-
Posts
999 -
Joined
-
Last visited
-
Days Won
3
Everything posted by PWaddict
-
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
PWaddict replied to ryan's topic in Modules/Plugins
@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); }); -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
PWaddict replied to ryan's topic in Modules/Plugins
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. -
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?
-
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.
-
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);
-
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.
-
Custom fields validation inside Images field.
PWaddict replied to PawelGIX's topic in General Support
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); } }); -
Custom fields validation inside Images field.
PWaddict replied to PawelGIX's topic in General Support
@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? -
CroppableImage3 1.2.0
-
[SOLVED] How to make file/image description required?
PWaddict replied to PWaddict's topic in General Support
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; } }); -
[SOLVED] How to make file/image description required?
PWaddict replied to PWaddict's topic in General Support
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. -
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?
-
Hello! Is there any way to force the recreation of the webp variation when the crop is edited?
-
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
-
-
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; });
-
No, I'm talking about the TinyMCE autolink plugin. You can find it on the Input tab.