-
Posts
979 -
Joined
-
Last visited
-
Days Won
3
Everything posted by PWaddict
-
Here is the solution. First, on the checkbox field (let's call it terms_privacy_checkbox) settings leave empty the "Checkbox label". On the field "Label" you can either write something for example "Terms - Privacy Policy" or leave empty (it will output field name) doesn't matter cause we gonna remove it with the following hook. $wire->addHookAfter('Page::render', function(HookEvent $event) { if($this->wire('page')->template->name != 'checkout') return; $event->return = str_replace("<span class='pw-no-select'>Terms - Privacy Policy</span>","", $event->return); }); Then with the following hook where we customize our form we can change the markup for the checkbox field too and split it to 2 divs using for example UIkit. $wire->addHookBefore('InputfieldWrapper::render', function($event) { if ($this->wire('page')->template->name != "checkout") return; $wrapper = $event->object; $terms = wire('pages')->get("template=terms"); $privacy = wire('pages')->get("template=privacy"); $defaultMarkup = array( // Check wire\core\InputfieldWrapper.php for the $defaultMarkup 'list' => "<ul {attrs}>{out}</ul>", 'item' => "<li {attrs}>{out}</li>", 'item_label' => "<label class='InputfieldHeader ui-widget-header{class}' for='{for}'>{out}</label>", 'item_label_hidden' => "<label class='InputfieldHeader InputfieldHeaderHidden ui-widget-header{class}'><span>{out}</span></label>", 'item_content' => "<div class='InputfieldContent ui-widget-content{class}'>{out}</div>", 'item_error' => "<p class='InputfieldError ui-state-error'><i class='fa fa-fw fa-flash'></i><span>{out}</span></p>", 'item_description' => "<p class='description'>{out}</p>", 'item_head' => "<h2>{out}</h2>", 'item_notes' => "<p class='notes'>{out}</p>", 'item_detail' => "<p class='detail'>{out}</p>", 'item_icon' => "<i class='fa fa-fw fa-{name}'></i> ", 'item_toggle' => "<i class='toggle-icon fa fa-fw fa-angle-down' data-to='fa-angle-down fa-angle-right'></i>", // ALSO: // InputfieldAnything => array(any of the properties above to override on a per-Inputfield basis) // Here we override the default markup for checkbox field by targeting it's name 'name=terms_privacy_checkbox' => [ 'item_label' => "", 'item_label_hidden' => "", 'item_content' => " <div class='uk-grid-collapse{class}' uk-grid> <div class='uk-width-auto'> {out} </div> <div class='uk-width-expand'> <label class='uk-form-label' for='Inputfield_terms_privacy_checkbox'> <span class='uk-text-normal'>I agree with the <a href='{$terms->url}' rel='noopener' target='_blank'>{$terms->title}</a> and the <a href='{$privacy->url}' rel='noopener' target='_blank'>{$privacy->title}</a>.</span> </label> </div> {error} </div>", ], ); $defaultClasses = array( // Check wire\core\InputfieldWrapper.php for the $defaultClasses 'form' => '', // additional clases for InputfieldForm (optional) 'list' => 'Inputfields', 'list_clearfix' => 'ui-helper-clearfix', 'item' => 'Inputfield {class} Inputfield_{name} ui-widget', 'item_label' => '', // additional classes for InputfieldHeader (optional) 'item_content' => '', // additional classes for InputfieldContent (optional) 'item_required' => 'InputfieldStateRequired', // class is for Inputfield 'item_error' => 'ui-state-error InputfieldStateError', // note: not the same as markup[item_error], class is for Inputfield 'item_collapsed' => 'InputfieldStateCollapsed', 'item_column_width' => 'InputfieldColumnWidth', 'item_column_width_first' => 'InputfieldColumnWidthFirst', 'item_show_if' => 'InputfieldStateShowIf', 'item_required_if' => 'InputfieldStateRequiredIf' // ALSO: // InputfieldAnything => array(any of the properties above to override on a per-Inputfield basis) ); $wrapper->setMarkup($defaultMarkup); $wrapper->setClasses($defaultClasses); foreach ($wrapper->children as $in) { switch ($in->name) { case 'email': $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-input'); $in->attr('required', 'required'); break; case 'pad_paymentmodule': $in->wrapAttr('class', 'uk-width-1-1 uk-margin-small-top'); $in->addClass('uk-radio'); break; case 'terms_privacy_checkbox': $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-checkbox'); $in->attr('required', 'required'); break; case 'customerForm': $in->wrapAttr('class', 'uk-width-1-1 uk-margin-medium-top'); $in->addClass('uk-button uk-button-primary uk-button-large'); break; default: $in->wrapAttr('class', 'uk-width-1-1'); $in->addClass('uk-width-1-1'); break; } } });
-
Anyone knows how to split the checkbox's input and label in 2 divs with Inputfield Markup to look like in the following screenshot? I'm using UIkit so this can be achieved like below but I can't figured out how to do this with Inputfield Markup. <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>
-
Hello @Mikel I'm testing the module and noticed 2 issues. I'm getting the following Warning x2 times when viewing the User Data Table page: Warning: Attempt to read property "type" on null in C:\laragon\www\mysite\site\modules\ProcessUserDataTable\ProcessUserDataTable.module on line 595 The Settings link on User Data Table page is broken as it has a hardcoded admin page name as "cms".
-
@ryan On ProcessWireUpgradeCheck module I'm getting a 500 Internal Server Error and I can ONLY see the updates for the PW dev and master version. No info about the 3rd-party modules.
-
I'm talking about backend files that getting inserted on frontend. I removed everything (header, footer etc.) from my template and just added only the execution line of LoginRegisterPro: <?php namespace ProcessWire; echo $modules->get('LoginRegisterPro')->execute(); ?> and as you can see from the screenshot below the FrontendForms files I mentioned on the previous post are getting inserted. This happens on every form of LoginRegisterPro (login, register, edit profile, forgot password) which are all exist on the same template and triggered by the above 1 line of code. These files are also inserted on every admin page too. You're right.
-
@Juergen the module's CSS / JS are getting executed on a page where LoginRegisterPro is executed even though I have already removed all CSS / JS from your module and the form used by FrontendForms is on a different page. EDIT: These are the files: site/modules/FrontendForms/backend/frontendforms.css?v=2.2.32-1745913193&time=1745913193 site/modules/FrontendForms/image-picker/image-picker.css?v=2.2.32-1745913193 site/modules/FrontendForms/backend/frontendforms.js?v=2.2.32-1745912921&time=1745912921 site/modules/FrontendForms/image-picker/image-picker.min.js?v=2.2.32-174591292
-
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; } });