Jump to content

teppo

PW-Moderators
  • Posts

    3,115
  • Joined

  • Last visited

  • Days Won

    102

Posts posted by teppo

  1. Been over a year since last update, so another quick heads-up: MarkupMenu 0.11.0 adds support for menu items as an array (as an alternative for the module figuring the menu structure out from current and root page, or reading it from a PageArray) and template strings as callables. Needed these two for a project I'm working on 🙂

    echo $modules->get('MarkupMenu')->render([
        'current_page' => $page,
        'menu_items' => [
            [
                'title' => 'Home',
                'url' => '/',
                'id' => 1,
            ],
            [
                'title' => 'About',
                'url' => '/about/',
                'id' => 29,
            ],
            [
                'title' => 'Parent',
                'children' => [
                    // ...
                ],
            ],
        ],
        'templates' => [
            'item' => function($item) {
                return empty($item->url)
                    ? '<span>{item.title}</span>'
                    : '<a href="{item.url}" class="{classes} {class}--level-{level}">{item.title}</a>';
            },
        ],
    ]);

     

    • Like 2
  2. Hey @Sten,

    Sounds like your field (moment) may be configured to output a date that strtotime doesn't understand. You could test by seeing what "echo $event->moment" returns; is it "2023-04-03 18:30:00" or something else?

    Anyway, one way to resolve this would be to replace "$moment=strtotime($event->moment)" with $event->getUnformatted('moment'). This will return a timestamp, so strtotime is no longer required.

    • Thanks 1
  3. On 12/2/2022 at 2:39 PM, szabesz said:

    There is also @teppo's SearchEngine but that is a 3rd party module and I am not sure it can be used for Faceted Search or not, for example.

    Short answer is "no", at least not for now 🙂

    SE populates a search index for a piece of content (page) and compares provided query string against said index. It's a tool for handling "regular" site search, from indexing to front-end rendering. The index is a textarea field, so complex queries (advanced text search) and a few special cases ("link:https://www.processwire.com") are supported, but the module has little to do with facets/filters.

    On a loosely related note, in recent projects I've been leaning towards implementing filters/facets on the front-end based on static data generated by the backend and cached on disk. The main reasons are performance and scalability: real-time search using ProcessWire can be pretty quick, but won't achieve the speed of a front-end only implementation. This is especially tempting approach when the amount of data is relatively small (i.e. you don't have to deal with tens of thousands of pages (or more) with numerous searchable properties each.)

    Which approach makes most sense — and how vigorously the search should / needs to be optimized — depends on the case at hand 🙂

    • Like 3
  4. Hey @Spiria — just a heads-up that I have merged your post to the Menu Builder support thread. Official support thread is the best way to reach module author. Looking back to the report in 2021, it looks like that earlier report might've just gone unnoticed.

    • Like 1
  5. Looks like MarkupHTMLPurifier used to skip tel: links in the past due to HTML Purifier not supporting them. This bypass was removed in 3.0.137, so after that version tel: links have likely had to adhere to stricter rules.

    5 hours ago, DrQuincy said:

    or tell clients they can only use +, - and 0-9 in phone numbers.

    I would likely go with this option, to be honest. But perhaps someone else knows how to customize Purifier — I've tried it once or twice, but eventually had to give up 🙂

    • Like 2
  6. I don't think there's any obvious way around this: PHP considers namespace declarations and use statements (aliasing/importing) on a per file basis.

    Quote

    Importing rules are per file basis, meaning included files will NOT inherit the parent file's importing rules.

    (Technically this could be achieved by some sort of file complication scheme, but in my opinion issues with that approach would easily outweight potential benefits.)

    It's a matter of preference of course, but I often use full namespace (e.g. \Wireframe\Lib\Utils::some_method()) in my views. Just feels more intuitive to me, even if it does add a bit of verbosity 🙂

  7. See the first bullet point under "Docker desktop may be used for free as part of a Docker Personal subscription for":

    Quote

    Docker Desktop may be used for free as part of a Docker Personal subscription for:

    • Small companies (less than 250 employees AND less than $10 million in annual revenue)

    This is repeated in other documents, including the service agreement. You don't have to (and can't, that would be quite impossible) fill all the conditions for free use, just one, and use within "small companies" (or "small businesses") is one of them.

    • Like 1
  8. 27 minutes ago, pwired said:

    By the way ... did someone mention that Docker Desktop is no longer free like it obvious was before ?
    I don't mean if you are running a company with 250+ employees

    If you develop closed source or proprietary software with Docker Desktop it requires a paid subscription for professional use.
    Selling Websites or Apps developed With Docker Desktop is commercial use and needs a Docker Pro license.

    Docker FAQ seems to disagree:

    Quote

    Docker Desktop may be used for free as part of a Docker Personal subscription for:

    • Small companies (less than 250 employees AND less than $10 million in annual revenue)

    This is further clarified in the Docker Subscription Service Agreement:

    Quote

    (a) The Docker Desktop component of the Service at the level of the Personal Offering (as described on the Pricing Page) is further restricted to: (i) your “Personal Use”, (ii) your “Educational Use”, (iii) your use for a non-commercial open source project, and (iv) your use in a “Small Business Environment”. [...] (iii) a “Small Business Environment” is a commercial undertaking with fewer than 250 employees and less than US $10,000,000 (or equivalent local currency) in annual revenue; 

    The Service Agreement is a bit messy (kind of seems like they might've updated one section and forgot another, so numerals are not in sync), but at least based on this the small business exception is still in place and applies to the desktop component as well 🙂

  9. 51 minutes ago, Martinus said:

    Old modules, from 2014, 2015, etc - are they still valid or has time and updates of the core left them behind?

    Was a bit slow to answer, so @gornycreative pretty much covered this already, but just to be clear: in my experience most of them are still valid. Potential exceptions may, for an example, include modules that for some reason rely heavily on a certain admin theme.

    Overall there have been very few breaking changes in the core through the years, so most — probably close to all — modules that worked for 3.0 (or even 2.x versions) still work today, some may just look a bit off. Or there may be a core feature nowadays that solves a similar need without a need for third party module 🙂

    One thing worth keeping in mind is thatolder modules typically don't have/use the ProcessWire namespace, which means that you'll have to keep FileCompiler enabled for modules. This is the case by default, so not a problem unless you've intentionally disabled $config->moduleCompile via site/config.php.

    51 minutes ago, Martinus said:

    Another example, I am looking for a admin theme to use so I can see which field is attached to which page (in columns) but I am afraid to just install anything that slightly resembles what i am looking for. After all, it always says 'at your own risk' and some are just really old. I am spending a large amount of time reading what can be found per module but I am also exhausted because, what am I looking for exactly?

    I must admit that this confused me a bit. If you're just looking to see which field is attached to which page, that doesn't sound like a reason to switch entire admin theme. Admin themes are generally more about the look and feel of the admin, not so much about the features included, while this sounds like a rather specific feature. I can't remember if I've seen exactly this type of list myself; fields are connected to templates, so usually you'd want to see which templates a field belongs to or which pages use a specific template, rather than which pages use a specific field 🙂

    If you're interested which fields have a value in specific field, then that's a different story. You can use the built-in pages find feature to list pages where that field is not empty:

    image.thumb.png.8f11af6dceed9b77674921dd8bd7fe48.png

    Also, as a general rule of thumb — and this is definitely more than a bit opinionated — I wouldn't recommend installing new admin themes unless you know what you're doing. While admin themes can be changed, and third party admin themes may work perfectly fine, generally speaking admin features are most likely to work best with the default (Uikit) admin theme.

    Then again, "at your own risk" is often just something developers say when they put stuff out there. It doesn't necessarily mean that something is broken — just that there's no guarantee that it will, and also no warranty in case it doesn't work 🙂

    51 minutes ago, Martinus said:

    I hope I am not offending anyone with these remarks but it would be nice to know where PW stands?

    Don't worry, asking questions is A-OK 🙂

    • Like 4
  10. Hey @fruid, just noticed this post in the modules forum. It would be best to post ProMailer specific questions to the ProMailer (VIP) support area of the forum — this way Ryan will notice them.

    I've never used a subscription form from ProMailer myself so can't really answer right away, but it looks like form markup is defined (and can be customized) via promailer-subscribe.php.

    You can find instructions for modifying ProMailer templates from https://processwire.com/store/pro-mailer/manual/#about-the-promailer-subscribe-page-template-file (specifically take a closer look at the part starting with "If you have any custom fields you also want to use, please do the following" under "Modifying the “Subscribe” form"). Custom fields are explained at https://processwire.com/store/pro-mailer/manual/#custom-fields-reference.

    --

    The modules area of the forum is intended for module-specific support threads (one thread per module) so I'm moving this thread to "General Support".

    • Like 1
  11. Hey @bernhard,

    I'm considering RockMigrations for a new project, but would very much prefer to install it via Composer to avoid bundling module code with project code, make updates easier, etc. I noticed that your old RockMigrations project had a composer.json in place, so would you mind adding that here as well, and preferably also submitting the package to packagist.org?

     Thanks in advance! 🙂

    Note that I would recommend using the options outlined here: 

    ... instead of hari/pw-module. The installer plugin from Hari was updated a while ago to support Composer 2, but it still lacks support for custom modules directory, for an example. In my opinion it would be best to eventually migrate modules to use composer/installers, since that's the "official" solution.

    • Like 1
  12. 4 hours ago, torf said:

    When I add a new page in my tree a logged in user can preview the page even when it is unpublished via the view button.

    This is the expected behaviour, with one catch: users with edit access to said pages should be able to view them. This always includes superusers.

    If you are certain that the sites themselves are identical (code and site settings, template settings, permissions, etc.) there are a couple of things to check first:

    - Is there some sort of caching on the live site that isn't present on the working environment?

    - Is the admin domain the same as the one used after clicking "view" links on the live site?

    • Like 1
    • Thanks 1
  13. 14 hours ago, 3fingers said:

    (virtual hugs too 🙂 )

    Not a Drupal developer (unless a small course on D6 years ago counts...) so this is the best I can do. You've got this 🙂

    Honestly, my two cents would be to try to embrace Drupal properly before making decisions about whether you like it. In my experience every major platform has ins and outs, some of which may take a while to grasp. I'm sure there's a lot of good in Drupal as well; for an example it sounds like they have solid integrations with many development-oriented tools, from Symfony components to Composer, PHPUnit and Nightwatch for testing, etc.

    Silver lining: sounds like an interesting learning opportunity!

    As for pushing ProcessWire, that may indeed be hard, especially if they have a good flow with Drupal. In terms of sales Drupal likely has an edge as well: a lot of folks have the impressions that Drupal is the go-to system for "enterprise open-source" content management, which is can make it easier to sell to certain types of clients. Perhaps suggest doing some smaller or in-house projects with PW, and see where it goes?

    Pushing anything too hard, especially to other developers, has a tendency to backfire 😉

    • Like 2
  14. If you're looking for a generic catch-all solution, there's one approach that I can think of: hooking before WireMail::send and checking if $event->object->bodyHTML is empty but $event->object->body filled, in which case you could generate the "bodyHTML" property based on the "body" property.

    I've never tried this, but at least this is where I'd start. Looking at ProcessForgotPassword code, there's no obvious way (config setting, hook, etc.) to make it send all messages as HTML, and I would assume that same applies to various other core (and non-core) modules as well, so your best bet is to hook directly into the class responsible for sending the message(s).

    Basically something like this:

    wire()->addHookBefore('WireMail::send', function(HookEvent $event) {
            if ($event->object->body && !$event->object->bodyHTML) {
                    $event->replace = true;
                    wireMail(
                            $event->object->to,
                            $event->object->from,
                            $event->object->subject,
                            $event->object->body,
                            "<p>" . nl2br($event->object->body) . "</p>"
                    );
            }
    });
    • Like 2
  15. If I got this right, you have a single images field that you use for two purposes: for images that are (automatically) displayed in a carousel, and for images that are (manually) embedded within a CKEditor (rich text) field?

    Simply put, my recommendation would be to use two image fields instead — one for your carousel, and one for your RTE images. You can then configure your CKEditor field to use the field intended for content images via the "Images fields that may be used for dragged-in or pasted-in images" setting (found from the "Input" tab of the field).

    For an example on sites I work with there is almost always a field called "content_images". This field is used specifically for images embedded within CKEditor content.

  16. 8 minutes ago, bernhard said:

    Can't you do a SHIFT+CLICK to select all from the first click until the last click?

    Sorry to hijack the thread, but... would you believe that I literally just learned that you can do this with checkboxes? That makes things so much easier. I've always considered this part of the admin pretty cumbersome, having to click all those checkboxes one by one 😄

    (Perhaps this view should include a note about this, unless this is something that everyone else already knows about?)

    • Like 2
  17. 22 hours ago, ryan said:

    What do you think, is this type of PW profile useful to you or someone you know?

    As it happens, I'm about to hop in a project where invoicing is a key part; while I don't know if I'll be able to use your site profile directly, at the very least it'll be interesting to dig in for ideas. What we see here already looks awesome ?

    22 hours ago, ryan said:

    What I plan to add next are payment options, enabling a client to pay by credit card right from the invoice URL or email. 

    Would be nice if this was implemented in a way where one can easily swap the payment processor, kind of like what Antti did with PaymentModule (and PaymentStripe, PaymentPaypal, etc.)

    • Like 9
  18. Definitely sounds like a job for ProDrafts. Version Control keeps track of changes after they've occurred, but there's no (automatic) way to put them on hold and apply after some action/trigger.

    In theory one could restore the page to previous revision automatically and step "forward" again once changes are approved, but that would get very complicated very fast, and going back and forth could also result in "conflicts" where updates applied meanwhile would simply get discarded. Anyway, that's not something I would recommend doing ?

    • Like 2
  19. 25 minutes ago, gebeer said:

    @teppo can this module handle multilang fields? Couln't find anything in the module description or this thread.

    README lists three supported multilingual fieldtypes:

    • Text (regular and multi-language)
    • Textarea (regular and multi-language)
    • Page Title (regular and multi-language)

    Technically other multilanguage fieldtypes should be supported as well, but these are the ones I've tested. Version Control has a config setting for enabling fieldtypes that are available on the site, but not listed as compatible by default.

    • Like 1
  20. 5 hours ago, palacios000 said:

    My problem now is: when the image gets rendered from PW, the orientation is correct; but when I fetch via http a variation of the same image, as you said EXIF data is lost, so the resized image has wrong orientation.

    Out of curiosity, which version of PW are you using?

    PW auto-corrects the rotation, and some issues related to this were fixed in version 3.0.197. Just wondering if updating to the latest stable version (3.0.200), for an example, would resolve this problem.

    5 hours ago, palacios000 said:

    Would it be not possible to remove all EXIF data on image upload, so PW has a neutral version of the image? Then the person who uploads the photo can check the orientation.

    My understanding is that PW doesn't remove EXIF data from uploaded image, just resized images — though I could be wrong here! One exception at least is that if you have configured a max image size for your image field, then it will be automatically resized after being uploaded, which means that PW no longer has any version of it with EXIF data in place.

    Anyway, I'm not sure which one you're talking about here: original uploaded image, or a PW generated size variation of it? If it's the latter, then currently there's no way to retain EXIF data, but the image should still be automatically rotated according to what was in said EXIF data.

    (There is an open issue about keeping EXIF data, at least in some cases, but no clear solution yet: https://github.com/processwire/processwire-issues/issues/1055.)

    • Like 1
  21. 8 minutes ago, maetmar said:

    Does anyone have and is willing to share a skeleton template to build a nav-tree menu (mulitlevel) with LATTE?

    Just wanted to point out that when it comes to building menus, it can get a bit... complicated. This is why modules such as MarkupMenu exist. I'm not saying that you can't build your own menu logic without a module using custom code, just that it's — in my opinion — one of those things that you don't necessarily need to ?

    Depends a lot on your use case, of course; some sites have a super simple menu logic. And sorry for going off-topic, as well as shameless self-promotion via MarkupMenu ?

×
×
  • Create New...