-
Posts
726 -
Joined
-
Last visited
-
Days Won
3
Everything posted by froot
-
ConfigurableModule CKEditor field inline CSS
froot replied to froot's topic in Module/Plugin Development
OK here I am answering my own question, courtesies to chatGTP… 'extraAllowedContent' => '*(*){*}', // Allow any element, with any attribute, and any inline style happy days! thoughts? -
Not sure if I or someone asked this before… I'm working on a module that implements Module, ConfigurableModule On the config.php page, I define a field like so: 'email_imprint' => array( 'label' => 'Email Imprint', 'type' => 'CKEditor', 'value' => '', 'useLanguages' => true ), This works fine. My question is, how can I make this CKEditor field allow for inline markup? If I want to allow inline css in a CKEditor field I define in the GUI I can configure this in the field's settings, but here… ?
-
access a related page templatefield's label in the current user language
froot replied to froot's topic in API & Templates
->getLabel() works perfectly! Thanks all! -
Hello Processwirers, I'm trying to access a field's label in the current user language: $this->template->fields->skills->label // returns either "skills" or "Kenntnisse" depending on the language /en/ or /de/ $this->related_tutor->template->fields->skills->label // always returns "skills" no matter the language The label for the field is set in different languages. related_movie is a related page (aka "page field") and that related page is a user, i.e. uses a system template (– might that be the issue?) Why doesn't this work for related pages?
- 1 reply
-
- related pages
- page field
-
(and 1 more)
Tagged with:
-
Hello Processwirers, I'm trying to access a field's label in the current user language: $this->template->fields->skills->label // returns either "skills" or "Kenntnisse" depending on the language /en/ or /de/ $this->related_tutor->template->fields->skills->label // always returns "skills" no matter the language The label for the field is set in different languages. related_movie is a related page (aka "page field") and that related page is a user, i.e. uses a system template (– might that be the issue?) Why doesn't this work for related pages?
-
how to return an array of the menu items? So far I was not successful. $menu = $modules->get('MarkupMenuBuilder');// $menu is an example echo $menu->getMenuItems('topmenu'); // topmenu is the name of my menu But it only returns Menu|Menu|Menu How can that be?
-
I'm trying to achieve the following: I already have a selectoptions field with a specific page array. I want to add custom links to that array that I would define as JSON inside another field "menulinks" on this very settings factory page. How can I access the fields value while I'm on the settings page? I understand I would need to save the page first before the value is accessible inside the options field? So how to access the value? It must be stored somewhere… // Assume $fields is your instance of the Fields API in ProcessWire // Fetch the 'menu_allocation' field $menuField = $fields->get('menu_allocation'); // Get the options for the 'menu_allocation' field $menuOptions = $menuField->type->getOptions($menuField); // Create an empty array to store the page arrays for each option $pageArrays = array(); // Loop through each menu option foreach ($menuOptions as $menuOption) { // Convert $menuOption to a string $menuOptionString = (string)$menuOption->title; // Create a selector to find pages with 'menu_allocation' set to the current option $selector = "menu_allocation=$menuOptionString, sort=sort"; // Find pages that match the selector $treePages = $pages->find($selector); // Convert the pages to an array $pageArray = array(); foreach ($treePages as $page) { $pageArray[$page->id] = $page->title; } // Add the page array to the main array $pageArrays[$menuOptionString] = $pageArray; } $inputfields = array( array( 'name' => 'menulinks', 'label' => 'menulinks', 'type' => 'textarea', 'value' => '', 'columnWidth' => 30, ), ); // json_decode the "menulinks" value to an array // merge the resulted array with the pageArrays // Loop through each page array and create 'asmselect' field foreach ($pageArrays as $menuOption => $pageArray) { $inputfields[] = array( 'name' => 'page_select_' . $menuOption, // Unique name based on $menuOption 'label' => 'Select a page for ' . $menuOption, 'type' => 'asmselect', 'description' => 'Select a page from the page tree for ' . $menuOption, 'columnWidth' => 100, 'useLanguages' => false, 'options' => $pageArray, // Use the page array as options for the 'asmselect' ); } return $inputfields;
-
?
-
is there a way to make the options multilingual?
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
froot replied to Nico Knoll's topic in Modules/Plugins
@adrian I get the following error with your fork version: 385: $pageData['og:image'] = $pageData['image'] ? $pageData['image']->httpUrl() : ''; The error only occurs on the "home" page and on direct children to home, not sure if that's important to mention, nor sure if the problem occurs because it cannot find an image to inherit? -
I'm facing a similar issue now, this PHP Warning: Undefined array key "EUR" in .../ServiceCurrencyConversion/ServiceCurrencyConversion.module:341 PHP Warning: Trying to access array offset on value of type null in .../ServiceCurrencyConversion/ServiceCurrencyConversion.module:341 and this is what it says in the module settings: ServiceCurrencyConversion: access_restricted - Access restricted until 2024-04-14 (reason: too_many_requests). If there has been a mistake, please contact support@openexchangerates.org. And the site is not even live, I'm still developing locally, so it's just me requesting. I have a free account with Open Exchange Rates. I wonder if I just programmed the request-handling poorly, I assumed the module would make a request to Open Exchange Rates via API and then cache the results somewhere? Or do I need to cache it somehow manually? I don't need real-time exchange rates, maybe just one per day for what ever currency is requested would be more than sufficient.
-
I did something like this: <div class="grid grid-cols-4 gap-4 border border-green-500"> <div class="col-span-3"> <img src="path/to/image.jpg"/> </div> <div class="col-span-1"> <p>Yada yada yada.</p> </div> </div> But the classes don't get applied. Might that have to do with where in which directories tailwind looks for tw classes? Here's my setup: /** @type {import('tailwindcss').Config} */ module.exports = { content: [ "../*.{html,php,js}", "../../classes/*.{html,php,js}", "./node_modules/tw-elements/dist/js/**/*.js", "../../assets/cache/HannaCode/*.{html,php,js}", "../../assets/*.{html,php,js}", "../../../*.{html,php,js}", "./node_modules/flowbite/**/*.js" ], That said, it does work for the hard-coded tw classes anyway, that's why I thought that might be the issue.
-
how do I extend my subscription?
-
I want the users to be able to subscribe to different lists depending on the page the subscribe form appears on. Is that doable? My guess is it should be, since it would be similar to the functionality of "following" a topic here in the ProcessWire forum – doesn't the forum use ProMailer for email updates? I read through the documentation and neither "custom fields" nor "users/pages list type" would accomplish what I want. Not the former as it would just save the page info (let's say that's I have a custom field for that) along with email address and whatnot in the user entry of the subscriber's list, and not the latter as it would just allow for a closed list of pre-defined users that no-one can subscribe to if they so wish. Thanks for help! I know ProMailer is a pro module but I cannot find (or access?) the ProMailer forum anymore.
-
Thanks @ryan I didn't see that checkbox but I did see an input field Number of Seconds to Cache Exchange Rate Data It was set to 86400, so I set it to 0 and saved. Then I was able to see the table with all codes, names, symbols and rates. Now I also see the checkbox. Weird, I am still on version 3. Anyways, yes, HKD is listed. (Actually not one currency was working before). Now it seems to work again. I wonder, if I need to do this regularly i.e. lower the number of seconds when the cache is cleared?
-
I'm having troubles using the methods ->getName() and ->getNames() $cc = wire('modules')->get('ServiceCurrencyConversion'); $currencyArray = $cc->getNames(); // array (0) $currency = 'HKD'; $cc->getName($currency); // null warnings: PHP Warning: Undefined array key "HKD" in .../ServiceCurrencyConversion/ServiceCurrencyConversion.module:341 PHP Warning: Trying to access array offset on value of type null in .../ServiceCurrencyConversion/ServiceCurrencyConversion.module:341 I logged into my openexchangerates.org account and there seems to be no outage. Any ideas what this could be?
-
Any news on that front? I have an images field on a page with a CKEditor field. When I add to that text content a gif from the images field, the gif gets resized and is not animated. I understand this is a bug that is yet to be fixed but is there a workaround in the meantime? Since I'm not displaying the images programmatically I cannot use the API e.g. Pageimage::getOriginal()
- 28 replies
-
- 1
-
-
I thought extending the user class was not possible since it's a special case and I should use the module approach instead. Has that change in the meantime?
-
Though this is very helpful, I am still not sure how this works. I can do stuff like this: i.e. access the custom public methods of the user object from outside the class. I have also of course no problem accessing private classes within the here discussed user extension class. However, how does the code change when I define and use a public method from inside and from outside the class. Do I need to pass it the $event?
-
Hello dear processwirers, I hope you are doing well. I'm a bit stuck implementing this module. Since the "Edit Profile"-form renders when the GET-params are "profile=1" But that form also submits to the same page with the same GET-params "profile=1" I don't see how I can redirect the page upon form submission without ruling out the case that the user is just on the edit profile page. That also means that when the form was submitted and I refresh the page, the browser asks me if I want to resubmit. In more technical terms: how can I edit the form action URL? Thanks for help!
-
[SOLVED] works! thanks!
-
I meant only return /de/ or /en/, is there no native method to do that?
-
what's the best way to return the user's current language specific URL segment? I mean for example /en/ or /de/ depending on the user's active language?
-
I want to create a web app where users can login/register via Google I've seen a handful of modules that promise similar things including Oauth2Login, SocialLogin and GoogleClientAPI What I need is the user to be able to login/register via their Google-account and upon that to be logged-in both in their PW-CMS account as well as in their respective Gmail-account in the browser and me to have access to specific data via Google API. My guess is I would need to combine two modules? Maybe GoogleClientAPI with LoginRegister? Or GoogleClientAPI with LoginRegisterPro? Or can GoogleClientAPI do both? Thanks for suggestions!
-
I'm trying to create a hook that would populate my SEO-Markup fields automatically with some field values of the page upon saving. For some reason I cannot access the MediaManager image field's ->media property and its properties, it returns null. I do see this in the tracy console though… //ready.php $wire->addHookBefore('Pages::saveReady', function($event) use($sanitizer) { $page = $event->arguments[0]; if (!$page->id) return; if ($page->isChanged('seo_title') || $page->isChanged('seo_image') || $page->isChanged('seo_description')) return; // SEO image :D if ($page->seo_image == '') { $filled = false; bd($page->mema_images); // see screenshot bd($page->mema_images->count); // 3 if ($page->mema_images->count > 0) { $imageURL = $page->mema_images->first->media->url; bd($imageURL); // null :( $filled = true; } if ($filled == true) { $imageURL = strval($imageURL); $page->seo_image = $imageURL; $page->message('SEO image was filled because it was empty :D'); $filled = false; } } // SEO description :D - this works fine if ($page->seo_description == '') { $filled = false; $description = ''; if ($page->preview != '') { $filled = true; $description = $page->preview; } if ($filled == true) { $description = SEOcleanUp($description, $sanitizer); $page->seo_description = $description; $page->message('SEO description was filled because it was empty :D'); $filled = false; } } $event->arguments(0, $page); });