-
Posts
5,009 -
Joined
-
Days Won
333
Everything posted by Robin S
-
Get unique parents from children and make them a page array
Robin S replied to cb2004's topic in General Support
This is the same as what @LostKobrakai showed in post 2: append() is identical to add(), and adding a page ID to a PageArray achieves the same as adding a Page object. The objective is to get the parents of the items in the first PageArray. -
I think the easiest way to do this is with Javascript/jQuery. Not too hard to write a script for this from scratch (that's what I've done in the past) but Google reveals a nice looking plugin that does it all for you: http://renaysha.me/anchorific-js/
-
Hi @horst, Do you mean a mean the access to the page is blocked, or access to files stored in a files/images field on the page? For the page itself I would think you'd use role-based access, or just do not give the page's template a template file. But you would have thought of this already so maybe you need something else? For the files you can enable $config->pagefileSecure and then do not give the guest role access to the page. See the blog post and the $config docs. Also, there is the FieldtypeSecureFile module.
-
To test it you'd need to set the inputfield to Hidden, create a new page, then check the value as described above. If it's an existing page that was previously edited when the field was set to Open or Closed (i.e. anything that actually rendered the inputfield) then the value will remain populated even after you change the inputfield to Hidden. That's because changing the inputfield to hidden wouldn't delete field data from the DB.
-
1. You can get the field value with $page->my_datetime and log it, dump it with Tracy Debugger, or echo it on the frontend. 2. You can check the database table for the field in PhpMyAdmin or similar.
-
Are you sure of this? I tested it quickly and it seems to not populate the field when set to hidden. If the inputfield is hidden then I expect its render method is never called so no default value is entered into it. Is there a difference between what you're wanting to do with this field and the "created" property that exists by default when adding a new page? Because if your field is hidden then nobody could ever edit it so it would always remain identical to the created datetime. So could you just sort your pages by "created"?
-
Got it, thanks. And your interpretation of those movies clearly goes much deeper than mine
-
Sounds interesting. Can you give an example of how that could be useful? Maybe something like a Friends field? On page "Bob", "Sue" is added to Friends - so on page "Sue", "Bob" is automatically added to Friends. Just trying to think through the different use cases for the module.
-
Looks like the page was deleted on 16 August for reasons of "Searches are finding only PR and trivial links, nothing at all summarizes to actual substance." Which is bizarre as a Google search for ProcessWire would obviously turn up a large number of results. Then the page was restored (by the same user who deleted it) on 1 October without explanation as to why, but only restored to Draft status.
-
Probably not: I answered my own question in the next post: The situation @Wanze replied to is a little different - not an order of page IDs but an order of values to match a field against.
-
When exporting web images (assets from design mockups) I follow this guide and it works great: https://www.viget.com/articles/the-mysterious-save-for-web-color-shift Working Space: sRGB Proof Setup: Monitor RGB Proof Colors: On (doesn't affect export - just ensures you see the same colour in Photoshop as you will in the browser) Save For Web Embed Color Profile: unchecked Convert to sRGB: unchecked
-
Is it possible to use a selector to find fields that have a given textformatter applied? I tried... $flds = $fields->find("textformatters=TextformatterHannaCode"); ...but the textformatters property is an array so I get an array to string conversion error. So a broader question would be: is it possible to use a selector to match inside a property that is an array? For the textformatter, is there a more efficient way than just iterating over $fields? $flds = []; foreach($fields as $field) { if( is_array($field->textformatters) && in_array('TextformatterHannaCode', $field->textformatters) ) $flds[] = $field; }
-
- 2
-
-
Set order of pages in PageTable field via API
Robin S replied to alexcapes's topic in API & Templates
I think that's just a coincidence if you add several pages one after the other without reordering them in the field. But because a page that's in a PageTable field can reside anywhere in the page tree there could be other pages added (that have nothing to do with the PageTable field) which would affect the sort property of the page. Intentional, because there are really two sort values - the sort property that belongs to the page itself (the tree sort) and the sort that belongs to the PageTable field. This is in the PT database table but doesn't seem to be passed though as a property of the pages when you get them via the PT field. @alexcapes The order of the field is set according to the order of pages in the PageArray (or array of page IDs) when you save it to the field. For example: $page->setAndSave('my_pagetable', array(1009, 1002, 1007)); // an array of page IDs // or $pa = $pages->find("template=my_template, sort=title"); // create and sort your PageArray however you like $page->setAndSave('my_pagetable', $pa); You could also do things like get the existing PageTable PageArray and then add pages using methods like insertAfter() But are you sure you have to delete and recreate pages? You could keep the existing pages and change just about any property of them without actually deleting them. Maybe explain the whole process of what you're doing and someone may be able to suggest a different approach. -
Set order of pages in PageTable field via API
Robin S replied to alexcapes's topic in API & Templates
I think "sort" is the sort order of the pages as they appear in the tree, which may be different than the order they appear in the PageTable field. -
Nice one! But just a small thing: you set $search to an empty WireArray and then immediately re-set it to an empty array: $search = new WireArray; $search = array(); You only need the latter.
-
+1 (I hate auto focus... ) Just wanted to add that I find the autofocus of the filter box specifically on the modules listing quite useful. I'd much rather type than scroll.
-
Did you do this bit...? But in any case if you update to LimitPageTable v0.0.3 linked in my first post above it adds a config option to choose which value you want to match against so no editing of the module is needed now.
-
It works well, thanks!
-
When adding a new module to the directory, after completing the first step where the link to the GitHub repo is entered, on the second step all the module information fields seem to be pre-populated with info from a different module of mine that is already in the modules directory. Is that normal? It's only the second module I have submitted so I'm not sure. I don't want to end up editing the info for the existing module instead of adding the new module.
-
Thanks for adding the Lister hover action buttons - something I've been wanting for a while. It's working for me in Lister Pro, but I do see some error notices too - not sure if this is what @adrian is referring to above. PHP Notice: Undefined variable: listerType in ...\modules\AdminOnSteroids\AdminOnSteroids.module:759 PHP Notice: Undefined index: in ...\modules\AdminOnSteroids\AdminOnSteroids.module:759 PHP Notice: Undefined variable: listerType in ...\modules\AdminOnSteroids\AdminOnSteroids.module:761 Would it be possible to activate the hover buttons for Lister Pro independently from the other Lister tweaks? The reason being that I'd rather set the columns for the Find and Users lister in Lister Pro and the AOS Lister columns feature interferes with this. Edit: what I mean is could there be checkboxes to activate the AOS Lister columns feature rather than the columns feature being active by default when "ListerTweaks" is checked? Not an AOS problem as it happens when the action buttons show on click too, but the columns jump around as the hovered row changes:
-
<?php if($tab_size == 'too big') { use \CSS; $to_change->it(); } else { $it_looks = 'stupid'; } ?> When pasting code indented with tabs into the forum the indents are too large. It's simple to fix with a bit of CSS: pre { -moz-tab-size: 4; tab-size: 4; } Could someone with the necessary access add this? The big indent bugs me so much I usually find/replace the tabs with spaces when posting code. And as is universally agreed by all quality coders: tabs are much better than spaces
-
Updated to v0.0.2. This version simplifies the module somewhat and you no longer need to select templates in the config.
-
I'm not sure what's the right way to use that. This gives me: syntax error, unexpected '/' $this->pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); /Tracy/Debugger::barDump($page); }); Do you remember which version of Tracy Debugger you introduced the Live dumps? Might be easier for me to roll back to an older version.
-
Hi @adrian I've been noticing something odd when dumping the $page variable inside a hook. I've noticed it when hooking several different methods, but take this hook for example: $this->pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); bd($page, 'page'); bd($page->name, 'page->name'); }); In this hook $page should be the page that is ready to be saved - let's say I am saving the Home page. But when I save the Home page in the admin, the dumped $page variable is for the "Edit" page (ProcessPageEdit). Which is weird, but what makes it weirder is that the subsequent dump of $page->name shows "home" not "edit". Any ideas on what is going on here?