Jump to content

All Activity

This stream auto-updates

  1. Today
  2. For a case like this you can use the hookable method to return any markup you like, including an image. It won't work for a UIkit tooltip though because that only supports text. Example: $wire->addHookAfter('PageFieldInfo::getPageInfo', function(HookEvent $event) { $page = $event->arguments(0); // The page $inputfield = $event->arguments(1); // InputfieldPage $field = $event->arguments(2); // The Page Reference field // Return custom markup if($field->name === 'colour') { $image = $page->get('image[0]'); if($image) $event->return = "<img src='$image->url' alt='$image->description' style='max-width:200px; max-height:200px; margin-top:10px;'>"; } });
  3. Yesterday
  4. Hello @nbcommunication, thank you for creating this module. I'd like to use it in my projects, I already configured it and it works, but there is a case when it doesn't. Basically when I edit an image in ProcessWire, then save, the modifications are only saved locally in ProcessWire site/assets/files and do not upload to Cloudflare. Also an issue, that cloning a page won't clone the related images in CF to a new folder with newly created page ID. I'm wondering why these happening, if they are just bugs? Right now I don't need to use Images and Stream in CF, my goal is to just use a CDN, and also to keep files in sync between my local and dev environments.
  5. My reason for looking into this is for things like a style block selection or a font selection - it would be great to be able to show an image below the selection instead of text. I'm not sure how well it would work for tooltips.
  6. I like what this does a lot. Have you considered allowing an image field to be selected and using, say, a thumbnail of the first image in the field to be shown?
  7. Thanks man! Finally, I did a brief write-up about Customers and Customer Groups.
  8. @Robin S Thanks for that detailed example. I actually did experiment with that hook before my post as well, and as your example demonstrates, you kind of have to hack it to show grandchildren in-line with their parents. Sorting then becomes weird because they are technically at different depths. This isn't the best UX. Ideally, if you expanded/opened the "Colors" child page, then it would show it's children "contained" inside of it, in a way that's somewhat similar to nested repeaters without repeaters. I was wondering if native support for the approach I described would be too much of a stretch given how PageEditChildren is currently programmed.
  9. @kongondo great work as always! Loving how easy it is to use the new customers and customer groups to create a custom dashboard for them. I've made an address book so that customers can create/update/delete addresses with ease and view/manage their orders. Next up will be to integrate the address book into the customer information form at checkout, rather than set the default address. This will be fun to work on πŸ˜ƒ Likewise, it was straightforward to get the discount codes feature integrated and this is working very well indeed. Really can't applaud your work on this big update enough!!! πŸ‘πŸ»πŸ‘ŠπŸ»
  10. Hi, I have updated the 009 release. In summary: Add method to PadloperDiscounts Class to remove all discounts applied to an (in session) order - removeDiscounts(). Thanks @alexm for the suggestion. Fix for missing 'padloper-customer' role that is given to Padloper customers for easier identification, etc. Thanks @alexmfor catching this. Fix for missing 'other optional settings' in the installer modal in list of actions to be applied when configuring Padloper. Thanks @alexm for catching this. Thanks.
  11. I put a utility together for working with .env files in ProcessWire and it makes use of the directory structure in the great post shared by @netcarver. I think this addresses the items brought up here about vendor directory placement and also provides a clean and simple method of implementation while providing some handy tools to boot. You can view and download the code for this .env implementation strategy from this repository. I wrote a small component/application that reads and caches .env file variables and makes them easy to work with in the ProcessWire config.php file. The readme in that repository provides a full rundown of directory structure and setup. Here's an overview of how it's used once you've configured it in your project. <?php namespace ProcessWire; /** * Example usage in config.php **/ use App\Env\Env; if(!defined("PROCESSWIRE")) die(); $env = Env::load(); // You can now access any variable in the .env file located in your root directory with an accessor method $env->get('YOUR_ENV_VARIABLE'); // => returns whatever that value is in .env // You can optionally make env values accessible globally in ProcessWire by assigning $env to a property // Then you can use $config->env->get('NAME_OF_VARIABLE'); $config->env = $env; // Use to set up your config values $config->debug = $env->get('DEBUG'); // ... But hey, why stop there? You can also do this: <?php namespace ProcessWire; /** * Example config.php file */ use App\Env\Env; if(!defined("PROCESSWIRE")) die(); $env = Env::load(); $config = $env->pushToConfig($config, [ 'useFunctionsAPI' => 'USE_FUNCTIONS_API', 'usePageClasses' => 'USE_PAGE_CLASSES', 'useMarkupRegions' => 'USE_MARKUP_REGIONS', 'prependTemplateFile' => 'PREPEND_TEMPLATE_FILE', 'appendTemplateFile' => 'APPEND_TEMPLATE_FILE', 'templateCompile' => 'TEMPLATE_COMPILE', 'dbHost' => 'DB_HOST', 'dbName' => 'DB_NAME', 'dbUser' => 'DB_USER', 'dbPass' => 'DB_PASS', 'dbPort' => 'DB_PORT', 'dbEngine' => 'DB_ENGINE', 'userAuthSalt' => 'USER_AUTH_SALT', 'tableSalt' => 'TABLE_SALT', 'chmodDir' => 'CHMOD_DIR', 'chmodFile' => 'CHMOD_FILE', 'timezone' => 'TIMEZONE', 'defaultAdminTheme' => 'DEFAULT_ADMIN_THEME', 'installed' => 'INSTALLED', 'debug' => 'DEBUG', ]); // Arrays aren't for .env files... $config->httpHosts = ['yourdomain.com']; // You can also get all of the values at once with this method $env->toArray(); What this does behind the scenes: Parses the .env file Casts booleans and ints appropriately where detected Caches the .env values in a file located outside of the public directory (read why below) Provides utility methods to access the .env data Optionally loads values to the server $_ENV array Values provided by the Env object are immutable Because ProcessWire has pretty much all of it's out-of-the-box configurations located in config.php, by default this only loads the values and makes them accessible via the get() method available on the object returned by Env::load(). You can optionally make your values available in $_ENV by passing 'true' to the load() method. About caching... This uses phpdotenv to read the .env file and load it's contents. There is some overhead for this process and requires significantly more work than just turning the .env into a key/value array. This application uses phpdotenv to parse the file then stores that in a cache file called env.php as a native array which is then subsequently loaded using require_once, an operation that is trivial for PHP to handle. Additionally, the object returned by Env::load() memoizes all values so the cached file is only read once during application execution and all subsequent key/value access is pulled from memory. Cache can be cleared using a provided method. I like how this came out and hope others find it useful. Interested in everyone's thoughts. It would really be great if installation and directory configuration were automated in a bash script, but I don't have the time. Pull requests are wide open for that 😎
  12. Awesome@Juergen, really nice work πŸ™‚ I've added a working demonstration of a customized security question using the new compareTexts validator to the PicoWire site profile If you want to add a customized CAPTCHA question to your form, disable CAPTCHA in the module configuration, and then add a custom text input with the new validator set as a rule // add security question field $question = new \FrontendForms\InputText("question"); $question->setLabel("Security question: What color is a green apple?"); $question->setRule("required")->setCustomMessage("Please answer the security question"); $question->setRule('compareTexts', ["green", "it's green", "the color green"])->setCustomMessage("Answer is not correct!"); $question->setSuccessMessage("Answer is correct!"); $form->add($question); This way you can completely customize your field like any other input, including error and success messages πŸ₯°
  13. Last week
  14. Ryan said in the previous announcement that you can use a hook to set which pages become editable. So you could use this to make the grandchildren editable, or the children and the grandchildren if you wanted the child pages to serve as a kind of visual divider between the categories of options. Edit: example... // Define custom "children" for PageEditChildren $wire->addHookAfter('PageEditChildren::getChildren', function(HookEvent $event) { /** @var Page $page */ $page = $event->arguments(0); if($page->template == 'blank') { $items = new PageArray(); foreach($page->children as $child) { $items->add($child); foreach($child->children as $grandchild) { $items->add($grandchild); } } $event->return = $items; } }); // Hook rendering of PageEditChildren "child" fieldsets // to apply a data attribute for identifying the template // It would be cool if PageEditChildren did this by default $wire->addHookBefore('InputfieldFieldset::render', function(HookEvent $event) { /* @var $fieldset InputfieldFieldset */ $fieldset = $event->object; $wrap_class = $fieldset->wrapClass(); if($wrap_class !== 'PageEditChild') return; $attr = $fieldset->wrapAttr(); if(!isset($attr['data-page'])) return; $p = $event->wire()->pages->get($attr['data-page']); if(!$p->id) return; $fieldset->wrapAttr('data-template', $p->template->name); }); Custom admin SCSS: li.PageEditChild[data-template="references"] { > .InputfieldHeader { background-color:#f0f3f7 !important; } }
  15. @ryan For PageEditChildren, would it be a stretch to have it support editing a children's children from the grandparent page as well? I typically have an /options/ page, and under it I have my page-based options... for example "Colors", "Sizes", "Order Statuses", like this: Options (template is 'options') Colors Red Green Blue Sizes Small Medium Large Order Statuses Pending Canceled Complete If I were to activate the 'options' template in PageEditChildren, I will be able to edit only the "Colors", "Sizes" and "Order Statuses" holder pages, not their children (from within the holder pages) which are the actual options themselves. Is there a way to perhaps support this? This is something I've been meaning to address more nicely in the past, but PageEditChildren would solve it with being able to edit grandchild pages.
  16. Thanks for the responses, guys. After a bunch of back and forth with Dreamhost, I ended up asking them to move us to a different web VPS and MySQL VPS. After they did that, the problem disappeared! Still not sure exactly what the issue was (my GUESS is either a network issue or another VPS on the same hardware causing an issue), but glad we got it figured out.
  17. My whole website is messed up. When I was installing modules for multilanguage support, I got the following errors: PHP 8.1.0 ProcessWire: 3.0.229 On the front: Warning: foreach() argument must be of type array|object, null given in ...\wire\modules\LanguageSupport\LanguageSupportPageNames.module on line 126 In the backend: Warning: foreach() argument must be of type array|object, null given in ...\wire\modules\LanguageSupport\LanguageSupportPageNames.module on line 126 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in ...\wire\modules\LanguageSupport\ProcessLanguage.module on line 340 ( ! ) TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in ...\wire\modules\LanguageSupport\ProcessLanguage.module on line 340
  18. Hey Ryan, thx for these additions! I'm wondering if there is a way to open a modal and then react/wait for something within that modal. For example we could maybe create an action for a page reference field to create a new page. When the page is successfully created in the modal and the modal is closed we could trigger the inputfield's reload event and the user could instantly select the newly created page.
  19. Hello @kaz, Conditional Check within the Included File (businesshours.php). try to Modify businesshours.php to check if the current page ID should display the address. <?php if (!isset($global->businesshours) || $page->id != 1127) { // Display the business hours content echo $global->businesshours; } ?> Use an if statement before the include to check the page ID <?php if ($page->id != 1127) { include('businesshours.php'); } ?> If you have multiple places where you want to conditionally include or exclude the business hours based on the page ID, consider modifying businesshours.php for a reusable solution. If this is a one-time case for page 1127, using a conditional include might be simpler.
  20. Hi Alexander, can you please help me? I got an email to mark the post (it is yours) to mark it as the solution. I am looking for the last hour where it is the button but IΒ have no idea. Do you know?

    1. wbmnfktr


      Go to the first post, click on edit and add [SOLVED] to the beginning of the title and that will do it.

  21. This week on the dev branch are a few updates to the core including the following: Support for Inputfield header icon actions defined in PHP. If you recall, a couple weeks ago we released header actions for Inputfields via the JS Inputfield API. Robin S requested that the same be available from the PHP Inputfield API, and now it is. More details can be found in the phpdoc for the Inputfield::addHeaderAction() method here. New link action was added to Inputfield header actions. This was also added by request and it's another type of header action that simply links to a URL. It can optionally be opened in a modal window. The $database API variable has been updated with a new $database->reset() method which resets the database connection. This is potentially useful after a "MySQL server has gone away" type error, to re-establish the connection. The $database->execute() method also now uses it to attempt to reestablish the connection (for a few tries) when appropriate. Though I've not yet been able to test this one with an actual lost connection. There were various other minor updates, optimizations and fixes this week as well. In addition to the above core updates, we've got a new version of the UserActivity module (v8) posted in the ProDevTools support board. This version adds support for the PageEditChildren module and can properly identify which child pages are being edited alongside the parent. Previous versions only identify the page open in the page editor, and not the children open in PageEditChildren. Thanks for reading, have a great weekend!
  22. @adrian I've checked and yes it seems to be to do with the settings tab. Sorry, didn't think to check that. Looks like it's a core issue.
  23. Oh, that helps a lot! Thanks @AndZyk!!πŸ‘πŸ‘‹
  24. @Kiwi Chris - does this happen with the Settings tab is hidden, or something else? I wonder if you'd mind checking if the same thing happens if you enable PW advanced mode and use the "Disable Settings Tab?" on a template (System tab). Thanks.
  25. Yes, in the first screenshot it show the two output files generated by xhprof and the second is a diff tool to compare the two files. Using a diff tool make easier to see the differences at a glance.
  26. I seem to have found a bug in this module. When installed, clicking save on a locked page saves changes, but when not installed, an alert 'This page is locked for edits' displays as expected.
  27. Thanks @flydev. What are you using to show that - xhprof?
  1. Load more activity
  • Create New...