Jump to content

Weekly update – 29 January 2021


ryan
 Share

Recommended Posts

This week we have a couple of useful new $pages API methods. They are methods I've been meaning to add for awhile but hadn't found the right time. The need coincided with client work this week, so it seemed like a good time to go ahead and add them. I'm doing a lot of import-related work and needed some simple methods that let me work with more page data than I could usually fit in memory, and these methods make that possible. These won't be useful to everyone all the time, but they will be useful in specific cases. 

The first is $pages->findRaw() which works just like the $pages->find() method except that it returns the raw data from the matching pages, and lets you specify which specific fields you want to get from them. For more details see the findRaw() documentation page.

There's also getRaw() method which is identical to findRaw() except that it returns the raw data for just 1 page, and like get(), it has no default exclusions.

The next method is $pages->getFresh(). This works just like $pages->get() except that it gets a fresh copy of the page from the database, bypassing all caches, and likewise never itself getting cached. ProcessWire is pretty aggressive about not having to reload the same page more than once, so this method effectively enables you to bypass that for cases where it might be needed. Again, probably not something you need every day, but really useful for when you do. More details on the getFresh() documentation page

I'm going to likely cover these new $pages API methods in more detail in a future blog post, along with some better examples, so stay tuned for that. I noticed there's some pretty great conversion and examples happening in the posts on page builders here, but have been so busy this week I haven't had a chance to dive in, but I'm really looking forward to doing so. Thanks and I hope you all have a great weekend!

  • Like 20
  • Thanks 3
Link to comment
Share on other sites

Hi Ryan,

thx for the update! Is there any reason why the label field is required? I find that really annoying - I'm leaving that blank most of the time while developing, because I see the name of the field instantly and change/fill the label only if the setup turns out to be working properly. Otherwise removing fields, renaming fields etc. is more work than necessary, because one always has to fill/rename one additional field that does not add any benefit. Would be great to revert this back to optional.

I like the new interface, though. But it would be better IMHO to show    name | type | label (optional)

eOh2tCA.png

PS: I saw that the page name fills automatically based on the label - that might be nice for all english speakers, but most of the others I guess will usually have different labels and field names, because the label is in their language while the field name is english...

  • Like 4
Link to comment
Share on other sites

6 hours ago, bernhard said:

Would be great to revert this back to optional.

+1 – please

6 hours ago, bernhard said:

have different labels and field names, because the label is in their language while the field name is english...

+1 – This should also be optional.

Link to comment
Share on other sites

  • 2 weeks later...

@ryan Since upgrade to 3.0.172, I have this notification alert :

Quote

Modules: Configurable module check failed for LazyCron. If this error persists, please do a Modules > Refresh.

And if use "Publish" button to publish a page I have this notification alert :

Quote

ProcessPageEdit: Saved Page: /testy/ - Cannot be published until errors are corrected

But if I uncheck "Unpublish" or if I publish from page list, the page is published.

Any idea ? How can I look for something to resolve it ?

  • Like 1
Link to comment
Share on other sites

22 hours ago, sebr said:

Modules: Configurable module check failed for LazyCron. If this error persists, please do a Modules > Refresh.

Same here. This is probably windows specific problem - at least in our company it is.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...