Jump to content

PW 3.0.106 – Core updates


ryan
 Share

Recommended Posts

Thanks for the new features Ryan!

Just one question though regarding the new $pages->find tag search feature: what happens if there is a field and a tag having the same name (ie name collision)? Does field name take precedence?

Edited by szabesz
typo
  • Like 1
Link to comment
Share on other sites

6 minutes ago, ryan said:

and it also warns you if you try to create a tag that collides with a field.

Great! There might be cases when updating a system with "field name == tag name". Is there any warning implemented fur such a scenario?

EDIT: or tags/fields are created via the API rather than the admin.

Edited by szabesz
see EDIT
Link to comment
Share on other sites

Thank you very much for these new and - as always - useful features.

I have a question regarding the update of pagination module (MarkupPagerNav) to automatically populate $config->pagerHeadTags.

@ryan you explained: To use, simply populate them in your document <head> after pagination has been rendered [...]

So, do you mean i have to insert some code within the <head> tags in order to generate <link rel='next'> and <link rel='prev'> tags? - If so: How exactly would i accomplish this task? I've heard the first time of $config->pagerHeadTags, neither found documentation in https://processwire.com/api/ref/config/ nor in https://processwire.com/api/ref/markup-pager-nav/ . But then again i think i wouldn't have to do anything manually if the modules populates $config->pagerHeadTags automatically?

Surely i misunderstood something basic here. Thanks in advance for some enlightenment.

Link to comment
Share on other sites

@Lenz https://github.com/processwire/processwire/blob/643c9d3a87ddd8d579c4879c2382a9170466344b/wire/modules/Markup/MarkupPagerNav/MarkupPagerNav.module#L675

$_pages = $pages->find('id>1, limit=10');
foreach ($_pages as $p) {
    echo "{$p->title}<br>";
}

echo '<hr>$config->pagerHeadTags: ', \htmlspecialchars($config->pagerHeadTags), '<br>';
echo $_pages->renderPager();
echo '$config->pagerHeadTags: ', \htmlspecialchars($config->pagerHeadTags), '<br>';

 

Link to comment
Share on other sites

Hi @ryan,

The new field tag features are cool, thanks!

It's not quite the same, but in some ways being able to use a different name (tag) to refer to a field in a selector is similar to a request I raised a while ago about an idea for field aliases. So for example if I have a field with a generic name like text_1, when it is in my employee template I can use it in my template file and selectors as first_name. That would help a lot with code readability and encourage more efficient field re-use. Could the new field tag features be leveraged in some way to add support for field aliases? Probably as a separate thing to tags, but perhaps building on some of the same code you added this week? 

  • Like 3
Link to comment
Share on other sites

Lenz: If you just output that $config var in your <head>...</head> it will take care of it for you. i.e.

<?=$config->pagerHeadTags?> 

It is just a shorter version of doing this (which you can do in any PW 3.x version): 

<?php
if($config->urls->next) echo "<link rel='next' href='{$config->urls->next}' />";
if($config->urls->prev) echo "<link rel='prev' href='{$config->urls->prev}' />";
?>

 

  • Like 1
Link to comment
Share on other sites

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...