ryan Posted June 15, 2018 Share Posted June 15, 2018 Several core updates this week including a new way to perform $pages->find() searches by using Field tags, a new Field tag manager, new methods added to our $input API variable, new Inputfield traversal methods, and more… https://processwire.com/blog/posts/pw-3.0.106/ 10 Link to comment Share on other sites More sharing options...
szabesz Posted June 15, 2018 Share Posted June 15, 2018 (edited) 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 June 15, 2018 by szabesz typo 1 Link to comment Share on other sites More sharing options...
ryan Posted June 15, 2018 Author Share Posted June 15, 2018 That's right, field names have precedence, and it also warns you if you try to create a tag that collides with a field. 4 Link to comment Share on other sites More sharing options...
szabesz Posted June 15, 2018 Share Posted June 15, 2018 (edited) 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 June 15, 2018 by szabesz see EDIT Link to comment Share on other sites More sharing options...
Lenz Posted June 15, 2018 Share Posted June 15, 2018 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 More sharing options...
fbg13 Posted June 15, 2018 Share Posted June 15, 2018 @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 More sharing options...
Robin S Posted June 16, 2018 Share Posted June 16, 2018 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? 3 Link to comment Share on other sites More sharing options...
ryan Posted June 16, 2018 Author Share Posted June 16, 2018 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}' />"; ?> 1 Link to comment Share on other sites More sharing options...
Lenz Posted June 16, 2018 Share Posted June 16, 2018 aha, now it's clear. @ryan Thanks a lot for clarifying this. Also thanks for the hint @fbg13 Link to comment Share on other sites More sharing options...
Lenz Posted June 16, 2018 Share Posted June 16, 2018 11 hours ago, Robin S said: [...] Could the new field tag features be leveraged in some way to add support for field aliases? [...] That'd be great! +1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now