
fliwire
Members-
Posts
73 -
Joined
-
Last visited
-
Days Won
1
Everything posted by fliwire
-
how to disable validation with processInput hook? Or maybe better solved this problem? Tried to load custom options and save value. $wire->addHookBefore('InputfieldSelect::render', function (HookEvent $event) { $InputfieldSelect = $event->object; if ($InputfieldSelect->name == "dselect") { $page = wire("page"); $event->replace = true; $options = [ "1" => "test2", "2" => "test3", "3" => "test4", ]; $attrs = $InputfieldSelect->getAttributes(); unset($attrs['value']); foreach ($options as $key => $value) { $selected = $key == $page->dselect ? "selected" : ""; $out .= "<option value='{$key}' $selected>{$value}</option>"; } $out = "<select " . $InputfieldSelect->getAttributesString($attrs) . ">{$out}</select>"; $event->return = $out; } }); // tried for disable validation $wire->addHookBefore('InputfieldSelect::processInput', function (HookEvent $event) { $field = $event->object; if ($field->attr('name') == "dselect") { $page = wire("page"); $event->replace = true; // $field->setAttribute('value', input("post", "dselect")); $event->arguments(0, $field); } });
-
Want to change Auth::login process with session::login hook but not working. Can i extend auth::login process ? // Routes.php wire()->addHookBefore('Session::login', function (HookEvent $event) { // Get the object the event occurred on, if needed $session = $event->object; // Get values of arguments sent to hook (and optionally modify them) $name = $event->arguments(0); $pass = $event->arguments(1); $force = $event->arguments(2); //HERE another database check for login // changed for testing not working $name = "prouser"; $pass = ''; $force = true; // Populate back arguments (if you have modified them) $event->arguments(0, $name); $event->arguments(1, $pass); $event->arguments(2, $force); }); // extend auth login wire()->addHookBefore('Auth::doLogin', function (HookEvent $event) { $auth = $event->object; $event->replace = true; $event->return = [ 'jwt' => $auth->createSingleJWTToken(), 'username' => "3254235" ]; });
-
$cached value is null after 1 minute first visit, after first refresh $cached value is ok. Bug or wrong usage ? //_init.php $cached = cache("cached2", 1 * 60, function () { // file_get_contents html and return array $array = []; return $array; });
-
hi : if u still support this module. can u fix this : item markup not set properly. (<div class='uk-width-1-4@m uk-margin-top'>{out}</div>) ProcessWire 3.0.165 $iHelper->markup = array( "list" => "<div class='uk-grid'>{out}</div>", "item" => "<div class='uk-width-1-4@m uk-margin-top'>{out}</div>", "InputfieldSubmit" => array( "item" => "<div class='uk-width-1-4 uk-text-right@m uk-margin-top'>{out}</div>", ) );
-
Using unpoly for last project needs to validate checkboxes. Normaly unpoly replace input parent .Inputfield div. When user checks fast input seems unresponsive because unpoly replace .Inputfield's content. So i need to inputfield's specific div to replace. Added custom div but unpoly still ignore selector for radios and checkboxes. I tried to solve the problem but the problem was unpoly <input type="text" name="email" up-validate=".email-errors"> <span class="email-errors"></span> $wire->addHookAfter('InputfieldForm::render', function (HookEvent $event) { // Get the object the event occurred on, if needed $InputfieldForm = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; $doc = new \DOMDocument(); $doc->loadHTML(mb_convert_encoding($return, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NODEFDTD); $xpath = new \DOMXPath($doc); $nodeList = $xpath->query("//div[@class='uk-form-controls-meta']"); foreach ($nodeList as $key => $node) { $parentID = $node->parentNode->getAttribute('id'); $parentID = str_replace("wrap_Inputfield_", "", $parentID); $parentID = $parentID . "_error"; $node->setAttribute("class", $parentID); } $return = $doc->saveHTML(); $return = renderNotices() . $return; $event->return = $return; });
-
Hi, i want to replace {meta_id} with $Inputfield->name. But not works as expected. {meta_id} replaced with parent "Fieldset" or "Form" name. $wire->addHookBefore('InputfieldWrapper::render', function ($event) { $wrapper = $event->object; $wrapper->setMarkup(array( 'item_content' => "<div class='InputfieldContent uk-form-controls {class}'>{out}</div><div id="{meta_id}" class='uk-form-controls-meta'>{error}{description}{notes}</div>", )); }); $wire->addHookAfter('Inputfield::render', function (HookEvent $event) { $Inputfield = $event->object; $return = $event->return; $return = str_replace("{meta_id}", $Inputfield->name, $return); // Populate back return value, if you have modified it $event->return = $return; });
-
Inputfield - issue with require attribute and front end validation
fliwire replied to chrizz's topic in API & Templates
via hook: $wire->addHookBefore('Inputfield::render', function (HookEvent $event) { $inputfield = $event->object; $page = wire("page"); if ($page->template == 'admin') return; if ($inputfield->required) $inputfield->requiredAttr = 1; }); -
Using InputfieldFile attach page images to value rendered properly, how to process "delete checkbox" on submit ?
-
delete "&lang=es" from query string: https://github.com/lexsanchez/VideoOrSocialPostEmbed/blob/12b939514f574f5885e2c0d1ea12ad04e85c873b/TextformatterVideoOrSocialPostEmbed.module#L278
-
no one same issue ?: session lost after payment ?
-
for those who experience the same problem on windows, especially large html content. <div id="content">...</div> // 10x slower for me <region id="content">...</region> // fast no problem
-
Hi, after redirect to payment page processwire session lost because of samesite cookies changed default to "lax". https://web.dev/samesite-cookies-explained/ tried to hook session::init but not works ? $wire->addHookBefore("Session::init", function (HookEvent $event) { ini_set('session.cookie_samesite', 'None'); session_set_cookie_params(['samesite' => 'None']); }); set by htaccess works <ifmodule mod_headers.c> Header always edit Set-Cookie ^(.*)$ $1;SameSite=None;Secure </ifmodule>
-
-
[SOLVED] How to display form errors under inputs?
fliwire replied to PWaddict's topic in General Support
$markup = array( 'item_content' => "<div class='InputfieldContent {class}'>{out}{error}{description}{notes}</div>", ); -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
fliwire replied to ryan's topic in Modules/Plugins
lol: yes works: -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
fliwire replied to ryan's topic in Modules/Plugins
$url = '<p>https://www.youtube.com/watch?v=PhToKXpSrYA</p><p>This is a simple <a href="https://processwire.com">ProcessWire</a> site profile that is somewhat like our default site profile, but also includes a blog. It demonstrates development of various features including some new to ProcessWire 3.x. The front-end of this profile uses the <a href="http://www.getuikit.com" target="_blank" rel="noreferrer noopener">Uikit 3</a> library and includes a library of time-saving functions for working with Uikit 3. Below are a few highlights you12ll find in this site profile:</p>'; echo $modules->get('TextformatterVideoEmbed')->format($url); added last line echo $str "protected function embedYoutube" $embedCode is there but not echo with format. -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
fliwire replied to ryan's topic in Modules/Plugins
error gone but not echo anything. -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
fliwire replied to ryan's topic in Modules/Plugins
not working: Fatal Error: Uncaught Error: Cannot pass parameter 1 by reference in -
you need to check images count if(count($page->images)) { // the page has one or more images } https://processwire.com/docs/fields/images/ https://processwire.com/api/ref/page/if/
-
tested with 3.0.155 all embed works after two changes: 1- Find textformatter_video_or_social_embed table change embed_code collation to utf8mb4 if not // changed to utf8mb4_unicode_ci 2- https://github.com/lexsanchez/VideoOrSocialPostEmbed/blob/57c254e64ae3c03139e2bb5119ffc676d92af39c/TextformatterVideoOrSocialPostEmbed.module#L103 update this line $embedCode = utf8_encode($data['html']);
-
tested: resource showing propery but with empy values. In database field saved with default resource and template resource. {"title":"","title1033":"","title1185":"","__json":null,"__name":"settings","__path":"D:\/Laragon\/www\/protest\/site\/templates\/configs\/Mystique.settings.php","video":"11111111","video1033":"22222222","video1185":"333333333","__resource":"settings"}
-
If admin language not default language, default language saved properly, but when showing field has wrong value. Overwrite seo field for home template: opengraph_description has value: "{seo.meta.description}". DB Data: {"opengraph_description":"{seo.meta.description1}","opengraph_description1033":"{seo.meta.description2}","opengraph_description1185":"{seo.meta.description3}"}