-
Posts
4,928 -
Joined
-
Days Won
321
Everything posted by Robin S
-
I presume you're using MarkupPagerNav. If so see the arrayToCSV option in the docs: https://processwire.com/api/ref/markup-pager-nav/#pwapi-methods-other-options But rather than change this option consider using the whitelist to store the sanitized search input and to set the values/states in your search form instead of using $_GET. See Ryan's Skyscrapers code for examples of how to do this: https://github.com/ryancramerdesign/skyscrapers2/blob/master/search.php https://github.com/ryancramerdesign/skyscrapers2/blob/master/includes/search-form.php
-
This isn't anything specific to this module - it's just the effect of output formatting being on or off. Unfortunately there is no general documentation page explaining the idea of output formatting but the $page->of() docs gives you some info. The rule of thumb is that output formatting is on in the frontend and off in the backend, particularly in a situation where field values are going to be saved like in the page editor. You can set the formatted value of a single image field to be a Pageimage but when output formatting is on it will always be a Pageimages array. So in FieldtypeRuntimeOnly you need to specifically ask for the formatted value of the field: $image = $page->getFormatted('squareimg'); if($image) { // ... }
-
'InputfieldPage::getSelectablePages' and ajax loaded field
Robin S replied to Jonathan Lahijani's topic in General Support
For so many items an autocomplete would perform much better. Is that an option? If it's the need to use a hook to specify selectable pages that's preventing you from using PageAutocomplete there are workarounds for this.- 1 reply
-
- 3
-
@szabesz, the output can't go below the button because the button is not in the results area. But I added a bottom margin so there is some separation from the button.
-
This might be a somewhat niche module but I had a need for it and maybe others will also find it a useful development helper. Lister To Clipboard Easily copy a selector for the current Lister filters or selected results to the clipboard. For superusers only. Why? Lister or Lister Pro is handy for finding pages according to certain page attributes or field values and you can see the matched pages in a results list. Sometimes I want to run code on some or all the Lister results. Lister Pro allows results to be processed through Page Action modules but there are a couple of downsides to this: To execute custom code you would have to create a custom Page Action module and this may not be worth the trouble for a one-off operation. If you want to process only selected individual pages you can only select items from one page of the results. If you navigate to a different page within the paginated results the selection is lost. Lister To Clipboard gives you an easy way to copy a selector for the current Lister filters or a selection within the results so you can paste it into the Tracy Debugger Console or use it elsewhere in your code. Usage In Lister (Find) or in a Lister Pro instance, create filters to match the pages you want to target. If you want to select individual pages within the results, click an empty area of the cell within the first column (i.e. don't click directly on the page title). The cell will get a green background to indicate that it is selected. If there is more than one page of results you can move around the pagination to select more pages. Below the Lister results there is a blue box showing a selector string that will find the pages shown in your Lister results (or your selection within those results) when used in $pages->find(). Click the copy icon to copy the selector to the clipboard, then you can paste it into the Tracy Debugger Console or wherever you want to use it. https://github.com/Toutouwai/ListerToClipboard https://processwire.com/modules/lister-to-clipboard/
-
How to upload files with dots in a file name?
Robin S replied to nicolant's topic in General Support
@nicolant, ProcessWire doesn't allow filenames to include dots, perhaps because Images fields use a dot to separate the variation suffix from the basename and Images and Files fields share some of the same code. If using dots in the filename is essential for some reason and you are willing to use an experimental module you could try this: https://github.com/Toutouwai/FieldtypeFileUnrenamed -
If by "featured" you mean "linked to within a CKEditor field" then it's pretty easy. You just upload the file to the first page it will be used on (Page A), and on any of the other pages you use the CKE link dialog to select Page A and then select the file.
-
One more possibility: get your non-user pages by path instead of by ID. If you use PagesLoader::getByPath() it should be just as robust as getting by ID because page path history will handle any renaming or moving of pages. And as a bonus the code is more readable because it's more obvious what page is retrieved by '/about-us/sustainability/' than by 24875. $p = $pages->loader()->getByPath('/about-us/sustainability/', ['useHistory' => true]));
-
I haven't been a regular user of the RuntimeMarkup module so I'm not qualified to talk about it. Maybe the best thing would be for you to try both modules and see which one suits you better.
-
I'm not sure what the reason for the ID limitation is, but you could set the value of each option to the integer you want:
-
Thanks for the report. It's hard to know when FormBuilder methods were added because there are no @since tags in the code. In v0.1.5 I've changed to older FB methods for better backwards compatibility.
- 17 replies
-
- 1
-
- module
- form builder
-
(and 1 more)
Tagged with:
-
@AAD Web Team, if you're wondering why status!=hidden doesn't work in this selector it's because status keywords like that are only supported in PageFinder selectors like $pages->find() that query the database, and not by selectors that match against a PageArray in memory. And although the docs don't make this clear $page->parents() actually adds all the parents one by one into a PageArray and then filters that PageArray by the selector. See here. It is a bit confusing that $page->children($selector) goes through PageFinder but $page->parents($selector) doesn't.
-
We're on the same wavelength - I meant turning it off in the Panel Selector. ? Ending the session if/when someone does that sounds like a good idea.
-
The no time limit sounds good, but I usually close the panel after I've switched user because it takes up screen real estate. Maybe just the End Session button would be enough, or maybe force the User Switcher icon into the debug bar when it's active (currently you can exclude that icon from the debug bar while a User Switcher session is active, although I don't know why anyone would do that). Thanks.
-
Hi @adrian, Sometimes I want to spend a whole day using User Switcher so I'm wondering if the maximum session length could be increased beyond 60 minutes. I'm sure there must be a good reason why it has a limit, so if it would potentially cause problems to raise the limit for everyone maybe there could be some $config option that would define the session limit? Thanks.
-
Yep, perfect, thanks! Just to spell it out for any future readers... if($session->tracyUserSwitcherId) { // Run this code only if browsing via User Switcher //... }
-
$user->isSuperuser() will return false just like you show in your screenshot, which is expected because User Switcher is active. But what I'm wanting is something like the pseudocode $user->isReallySuperuser() that would return true when User Switcher is active. Now it doesn't need to be some method of $user, but I'm wondering if Tracy might be able to offer something that allows for a simple way to check if User Switcher is active and being used by a superuser (not sure if users less than superuser could even access User Switcher - I've never needed to allow that). Or maybe Tracy already does expose something that could be easily checked for this purpose?
-
Hi @adrian, If I'm working on a site that other users have access to I'll often do something like: if($user->isSuperuser()) { // Run this code for me only //... } But if I'm presenting as another user via the User Switcher panel then this won't work. Do you know of an easy way to check if the current user is in reality a superuser but is currently browsing via User Switcher? Thanks for any suggestions.
-
If you can create a simplified demonstration case you could open a core GitHub issue because id.sort is supposed to cause results to be in the order of the supplied IDs. For now you could follow the approach used in my FindMerge module, where array_slice() is used to get a slice of the IDs according to the current page number: https://github.com/Toutouwai/FindMerge/blob/cbc6f43138508a52ae095c7041dbb969cc7d7bf7/FindMerge.module#L86-L99
-
@Arcturus, I just released v0.1.4 which adds a hookable method for users like yourself who want to do advanced customisation of the CKEditor inputfield, so you don't need to hack the module itself. See the updated readme. Setting the stylesSet property is working for me. $wire->addHookAfter('InputfieldMarkupCKEditor::ckeReady', function(HookEvent $event) { /** @var InputfieldCKEditor $cke */ $cke = $event->arguments(0); /** @var FormBuilderForm */ $form = $event->arguments(1); /** @var FormBuilderField $field */ $field = $event->arguments(2); if($form->name === 'test_form' && $field->name === 'my_cke_markup_field') { $cke->contentsCss = '/site/templates/MarkupCKEditor/contents.css'; $cke->stylesSet = 'ckstyles:/site/templates/MarkupCKEditor/ckstyles.js'; } }); CKEDITOR.stylesSet.add( 'ckstyles', [ { name: 'Special heading', element: 'h2', attributes: { 'class': 'special-heading' } } ]); Make sure the prefix you are using in the setStyles property matches the style set name in the JS file.
- 17 replies
-
- 1
-
- module
- form builder
-
(and 1 more)
Tagged with:
-
v0.2.0 of the module is released, which is a fairly major update that brings support for Repeater, FieldsetPage and Repeater Matrix fields. Using the "Field widths" field you can quickly set the width of inputfields within a Repeater/FieldsetPage field or within each Repeater Matrix type. Repeater: Repeater Matrix:
-
-
@formulate, it sounds like you want to have some prioritised subset of the results interleaved with the rest of the results, so they are distributed rather than grouped near the end where they would otherwise appear. There isn't any "sort" value you can use in a selector to do this because sort can only work by ordering results based on some specific column in the database, and no such column exists for your case. So like @DaveP said, you need to get all the results and then apply the sort order yourself. But when you have large numbers of results you want to avoid loading all the results in a PageArray. It's more efficient to work with just the IDs and then get paginated results from those IDs, and to do that you can use the id.sort feature that @Jonathan Lahijani mentioned. Here's a demo of how you might do this. This is simplified to just use templates to distinguish between the priority results and the other results but you will be able to adapt it to your case. // Do the custom sorting using only page IDs for efficiency $priority_ids = $pages->findIDs("template=colour"); $other_ids = $pages->findIDs("template=country"); $merged_ids = []; // Loop over the $other_ids (this should be the larger of the two arrays) foreach($other_ids as $key => $id) { // Use modulo operator to insert one priority ID for every two other IDs if($key % 2 === 0) { $merged_ids[] = array_shift($priority_ids); } $merged_ids[] = $id; } // If there happen to be any priority IDs left over when the loop is finished, add them at the end if(count($priority_ids)) $merged_ids = array_merge($merged_ids, $priority_ids); // Now use id.sort to get pages matching the IDs in paginations of 20 $results = $pages->find([ 'id.sort' => $merged_ids, 'limit' => 20 ]);