Jump to content

schwarzdesign

Members
  • Content Count

    80
  • Joined

  • Last visited

  • Days Won

    3

schwarzdesign last won the day on June 6 2019

schwarzdesign had the most liked content!

Community Reputation

166 Excellent

About schwarzdesign

  • Rank
    Full Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @ryan Can you take a look at the issue? This bug is causing some issues with one of our projects, and it should be a 5 minute fix ...
  2. @Robin S Alright I'll try this, thanks!
  3. Hi @Robin S, how do you feel about adding integer fields to the dialog? I have some fields that would benefit from allowing numbers only. I have tested adding the InputfieldInteger with inputType 'number' (for HTML5 support) and it works well: // iframe_form.php $type = 'InputfieldText'; if(isset($types[$key])) { switch($types[$key]) { /** ... */ case 'integer': $type = 'InputfieldInteger'; break; } } $f = $this->modules->get($type); if ($type == 'InputfieldInteger') { $f->inputType = 'number'; } Would you consider adding something like this to the module?
  4. We recently relaunched the website of IBIS Backwaren, a brand for international pastries and bakery products. Concept, design and implementation by schwarzdesign, built with ProcessWire. As always, we aimed to deliver a clean website design with a focus on content and fast loading times. Here's a list of modules used on this site, followed by a couple of interesting features included. The site is bilingual, though currently only the German version is available. The English version will be released at a later date. ProFields FormBuilder WireMailSMTP Cache Control MarkupSitemap Hanna Code Automatically link page titles Unique image variations Product database and product collections The website features a product database with all the products IBIS distributes. The product template is rather extensive, including fields for product categories and attributes, nutrition facts, certifications etc. We make heavy use of page reference fields, e.g. for product categories and attributes such as vegan or gluten-free products. Nutrition facts are stored in a Textareas field. There are multiple ways for visitors to explore products. One is a classic product finder with filters for product category and attributes. But there are also individual product collections (Produktwelten) which can be regularly updated by the client. Product collections include a list of related products. This allows the marketing department to quickly set up targeted landing pages. Recipes and custom forms Another approach to marketing and activating fans is the recipe section. Each recipe uses at least one IBIS product to give visitors some ideas. Of course, recipes and products are cross-linked to allow for exploration and discovery. There's a recipe submission form which allows you visitors to send in their own recipes, as well as a couple of other forms. All forms on the site are built with the Form Builder module. We made use of the form submissions to pages feature, which automatically creates a new (unpublished) page for new recipe submissions. Those can be reviewed by the staff and published directly. We also use a hook to automatically transform the plaintext fields for ingredients and instructions into HTML lists. Multi-brand IBIS uses different brands for different sets of products. Some landing pages as well as the gluten-free selection are branded differently. To accomodate this, we create an additional "brand" template with an override for the default logo. Each page has a brand selection field to allow switching the logo / branding for that page. Since brands are represented by normal pages, then client can create additional brands on their own.
  5. Thanks for your help @Robin S!
  6. Hi @Robin S, I have tested a couple more scenarios, I believe the missing dropdown has something to do with the dynamic AJAX-loading of repeater matrix items. If I set "Repeater dynamic loading (AJAX) in editor" to "New items only", the Hanna Dialog appears on all existing repeater items. Though if I then add a new repeater matrix item of a type that's not used on this page yet, the Hanna Dialog is missing. Once I save the page and the new item is loaded through the normal page visit, the Hanna Dialog shows up. So probably the hook that adds the JS settings just doesn't fire for AJAX-loaded items? To test this, I've put a bd($key) statement on this line where the extraPlugins config is added. When dynamic loading for my repeater field is set to "New items only", it shows all CK Editor fields, even those inside the repeater matrix: But if I activate AJAX-loading for all repeater items, the matrix CK Editor inputfields don't show up: --- So, disabling AJAX mostly fixes the problem, though the dialog is missing form newly added repeater matrix items before the page is saved. Do you think it's possible to make this work with AJAX-loaded repeater matrix items as well? Thanks for your help! --- EDIT: Another thing I found: It's working fine when I disable all local field overrides for the CK Editor field (it's set to required in the Repeater Matrix context). So probably if there are no overrides the Matrix just uses the config of the normal "InputfieldCKEditor_html_basic", which includes the HannaDialog, but if there ARE overrides it generates the "InputfieldCKEditor_html_basic_matrix1" configs which DON'T include the HannaDialog plugin because they're loaded through AJAX. Does that make sense?
  7. @Robin S Yes, that's the version I'm using. Hm, curious. Though that's not the first issue I have with CK Editor fields inside RepeaterMatrix fields (see the thread you linked above as an example). I'm wondering if there's something wrong with my ProcessWire installation or something. I'll investigate further next week!
  8. Thanks for the follow-up @Robin S. The toolbar settings are correct – the same field is displaying the toolbar item fine when it's not inside the RepeaterMatrix field. Which version of RepeaterMatrix have you tested this with? I'm using the current v5-dev Version. I just switched to RepeaterMatrix v4 as a test, with this version it's working correctly. Can you check if you're getting the same problem in the v5-dev version? Thanks!
  9. Hi @Robin S, thanks for this module! I'm having a problem getting the toolbar element "Insert Hanna Tag" into the toolbar inside a nested RepeaterMatrix field. Everywhere else it's working fine, but it just won't appear on fields that are part of a RepeaterMatrix field that are nested inside another RepeaterMatrix field. They are loaded through AJAX, but I don't think it has something to do with that. It is working fine with a regular Repeater nested inside a RepeaterMatrix that is loaded through AJAX, for example. Do you have any idea what may be causing this? Thanks! EDIT: Ok scrap the above, the problem doesn't appear to be related to the fields being nested. In fact, ALL CKEditor fields that are part of a RepeaterMatrix field don't get the Hanna Dialog toolbar element. Regular repeaters work fine, even if nested inside a Repeater Matrix field. Maybe it has something to do with the way the module checks for CK Editor fields?
  10. Thanks @Robin S, that did the trick! @dragan Thank you for your suggestions as well! I adjusted the code a bit to only trigger during POST requests; this way, the form will still display the * required markers, but the form will validate successfully despite the missing fields. Here's my final code, if someone needs it: // site/template/admin.php $wire->addHookAfter('ProcessPageEdit::buildFormContent', function (HookEvent $e) { $formwrapper = $e->return; $page = $e->object->getPage(); $userRoles = wire('user')->roles; $isPrivilegedEditor = $userRoles->has('superuser') || $userRoles->has('editor'); $isPost = wire('input')->requestMethod() === 'POST'; if ($isPost && $page->template->name === 'client' && $isPrivilegedEditor) { foreach ($formwrapper->getAll() as $inputfield) { $inputfield->required = false; } } }); require($config->paths->adminTemplates . 'controller.php'); One thing I got stuck on is that the hook needs to come BEFORE the require statement at the bottom. Otherwise, the hook would be added to late and wouldn't fire at all.
  11. We use the field settings (required, min / max length, description, notes) mostly to display our custom-built front-end forms. So by marking a field as required, it will be rendered as such in the front-end form (frontend validation) and validated accordingly upon submission (backend validation). We do it this way because we have a lot of fields for this template – to make it easier to manage those, we just use the built-in field settings. Of course, the obvious solution would be to just not have those fields as 'required' fields. But that would mean we'd need another layer of settings to select required fields for the frontend-forms, or hard-code that into the template, both of which aren't good solutions. In fact, the normal page editor is much less important than the front-end forms in this case. The users won't see it, only site admins – and it's annoying for the latter. We could live with that, but it would be nice to suppress those warnings, because you need to scroll down two screens to see the actual content because of all the warnings and they have no meaning for us in this case.
  12. @dragan Thanks, but that doesn't solve the problem. I neither want to restore the previous value, nor unpublish the page upon saving. I just want the editors to be able to edit some fields without getting errors about missing required fields.
  13. Short question: I'm looking for a way to suppress the error messages that appear on the edit page (ProcessPageEdit) after saving a page while required fields are missing. I also want to remove the flagged status for those pages as well. Longer context: I'm building a very large template with many fields that are filled through a couple of custom forms in the frontend. We generate the frontend forms mostly based on the field settings from ProcessWire, so there are a bunch of required fields. However, we still allow site admins to manually edit pages in the backend. The problem is that if half the data is still missing, saving the page will generate a bunch of error messages because of the required fields. I would like to be able to suppress those warning, as well as the "flagged" status the page gets after saving it with invalid data, so that site admins can edit those pages without having to worry about the required fields. Is there a hook I can use? I had a quick look at ProcessPageEdit, but couldn't figure out yet where I need to hook in order to clear out the error messages after they are registered. I'm grateful for every advice. Thanks!
  14. I'm having a problem with the built-in $session->redirect() method, namely that it supports only the 302 and 301 status codes. I'm currently working on a form that uses POST requests to update some page fields. After processing the request, I want to send the visitor to another page. The correct HTTP response code for this situation is 303 See Other, because the user-agent is not supposed to repeat the POST request to the new page. It would be a great addition for $session->redirect to support any of the possible 30x status codes, so it can be used in cases like this. For now, I have added this functionality with a hook (see below), but there are two problems with that: $session->redirect does some additional work, namely making sure current notices are correctly queued up as well as forcing graceful shutdown in some situations. This can't be done in a hook because, for example, the method calls $this->queueNotice, which is a protected method, so it can't be called from outside the class. Hooking before or after the redirect method isn't an option here either: Hooking after won't work at all, because the method calls exit(0) at the end, so any hook after that won't be executed. Hooking before may work in some situations, but the method may still overwrite headers set in the before hook, so it won't be reliable in any way. Can you give this a look @ryan? Maybe the method could allow integer arguments as well as booleans, and set the status accordingly if it's one of the allowed 30x codes? For reference, here's my workaround, though this does not perform all the graceful shutdown actions the built-in $session->redirect handles ... // site/ready.php wire()->addHook('Session::redirectStatus', function (HookEvent $e) { $session = $e->object; $url = $e->arguments(0); $httpCode = $e->arguments(1) ?: 302; if (!in_array($httpCode, [300, 301, 302, 303, 304, 307, 308])) { throw new \InvalidArgumentException('HTTP response code for redirect must be a valid 30X code.'); } $statusData = array('redirectUrl' => $url, 'redirectType' => $httpCode); $e->wire()->setStatus(ProcessWire::statusFinished, $statusData); header("Location: $url", true, $httpCode); exit(0); }); // somewhere in a template file $session->redirectStatus($somePage->url(), 303);
×
×
  • Create New...