Jump to content

Robin S

Members
  • Posts

    4,931
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. Thanks. I assume you mean if you accidentally add a description because the point of this module is that it hides the fieldset that surrounds the fields so you wouldn't expect to be able to see any description. In v0.1.7 the module explicitly hides any description and notes for the fieldset so if these are accidentally present they won't disrupt the intended layout.
  2. Pages will only appear in the dropdown menu if those pages have a Process assigned. See here. In effect this usually means "pages that use the admin template". You could possibly create a custom Process module that you use to redirect to other pages in the module's execute() method. Then create new pages using the admin template and select your Process. See here for an easy way to set the menu icon of admin pages. But also consider using the "nav" item in the getModuleInfo() method of a custom Process module. This lets you define some dropdown menu items for the Process when the page is in the top menu. ProcessModule is an example. Unfortunately you cannot set the first level of dropdown items dynamically. https://github.com/processwire/processwire-requests/issues/189 The top menu is cached (unnecessary in my opinion) so if you are making changes and not seeing them reflected in the menu then do a Modules > Refresh (and Tracy has a handy shortcut). Add "#ProcessPageEditChildren" to the URL. /your-admin-page/page/edit/?id=1234#ProcessPageEditChildren
  3. What is the showif condition you are using for the Page Reference field? If the visibility depends on the value of the Roles field make sure you are matching by role ID, e.g. roles=1234|1235
  4. I don't think you'll be able to use that combination because PageTable isn't supported inside a Repeater, and FieldtypeFieldsetPage is very closely related to FieldtypeRepeater (see the intro blog post). This post has a handy summary of fieldtype compatibility (written before FieldsetPage existed): So if changing your PageTable to RepeaterMatrix is an option then that will likely work inside FieldsetPage. AdminActions has an action for migrating PageTable to RepeaterMatrix.
  5. Try using urlencode() on the image URL to deal with spaces and other potentially problematic characters.
  6. The HTML Entity Encoder is probably applied to the title field (which is good). So you need to turn off output formatting for $quizPage... $quizPage->of(false); ...or at least get the unformatted value of the title field... $record->title = $quizPage->getUnformatted('title');
  7. If the search phrase is coming from user input you'll need to sanitise it through $sanitizer->selectorValue or else there are a range of search phrases that will break your search and cause an error. But "%" is filtered out by $sanitizer->selectorValue by default, because it is a character that is used in a selector operators, e.g. "%=", "%$=", etc. So if it's important that "%" be allowed you'll need to add it in the whitelist option, but bear in mind that this will possibly allow some search phrases that could break the search or return incorrect results. Not sure how likely that is in practice. The basic operators that appear to work with % in the search phrase are *= and %=. The %= operator allows partial word matches so it depends what you want. If you want to match multiple words in any order you'll probably want use an approach where you explode to individual words then build up a selector string.
  8. InputfieldWrapper extends Inputfield which implements Module. Do you get an error or something when you install this example module?
  9. I don't understand the question. ConnectPageFields <= v0.3.1 requires PW >= v3.0.0 ConnectPageFields >= v0.3.2 requires PW >= 3.0.166
  10. You're right, I think the vulnerability was only able to be exploited on systems where Adminer had been left in a publicly accessible location.
  11. I believe so, give it a try. I can't test easily because my WAMP package has a mail sender built in.
  12. It depends who needs to see these test emails. If only you, the developer, needs to see them you can use Tracy Debugger's Mail Interceptor panel and then (I think) you won't need an email server.
  13. I did a bit of reading about this last night and reports are that in Adminer v4.6.2 and below there was a security hole that hackers exploited to attack WordPress and Magento sites - not sure if other platforms were vulnerable but given that Adminer is a general DB tool I assume so. But this hole was patched and consensus seems to be that recent versions of Adminer are safe. So I wonder if the OP's host has an overly broad rule that is simply flagging Adminer generally rather than detecting specific versions. Having said that, I checked the Tracy Debugger history and the first bundled Adminer version was v4.6.3 so it was kind of a near miss. Maybe it is better that the Adminer panel is separated into its own module so that having it present on a server is more of a conscious choice. I think it's an awesome addition to Tracy so I'll be installing it for sure.
  14. Very interesting, although the visualisation doesn't quite demonstrate the fact that the bundled site profiles make up more than half of the total ZIP filesize when you download PW from the repo. I believe this has some negatives so I'm keen to start a discussion about moving most of the profiles to separate repos. For anyone interested, please participate here: https://github.com/processwire/processwire-requests/issues/415
  15. You need to get the unformatted value of the Page Reference field in order to have unpublished pages appear: https://github.com/processwire/processwire-issues/issues/1159 $value = $page->getUnformatted('your_field_name');
  16. When you say "uses", do you mean your module extends ProcessPageLister? If not that would probably be the simplest approach because then bookmarks will work out-of-the-box. Here's a bare-bones example: <?php namespace ProcessWire; class ProcessListerExtend extends ProcessPageLister { /** * Module information */ public static function getModuleinfo() { return array( 'title' => 'Lister Extend', 'summary' => 'An example of a module that extends ProcessPageLister', 'version' => '0.1.0', 'author' => 'Robin S', 'icon' => 'search-plus', 'requires' => 'ProcessWire>=3.0.0, PHP>=5.4.0', 'page' => array( 'name' => 'lister-extend', 'title' => 'Lister Extend', 'parent' => 'setup', ), 'useNavJSON' => true, ); } /** * Init * * Load the CSS and JS assets for ProcessPageLister rather than needing to duplicate them in this module's folder */ public function init() { $this->wire()->modules->loadModuleFileAssets('ProcessPageLister'); parent::init(); } /** * Install * * Call Process::install() to automatically create the admin page for the process on install * This is needed here because ProcessPageLister overrides with an empty install() method */ public function ___install() { Process::___install(); } /** * Uninstall * * Call Process::uninstall to automatically removes the admin page for the process on uninstall * This is needed here because ProcessPageLister overrides with an empty uninstall() method */ public function ___uninstall() { Process::___uninstall(); } } Wherever you need to modify a method of ProcessPageLister you can create a corresponding method in your module to override it, and you can make use of parent::methodName() within your method if you just want to add something to the ProcessPageLister method.
  17. Generally speaking this is already possible. The syntax is: !your_field_name^=foo Paths are a special case though because these are only searchable when the PagePaths module is installed and that module doesn't support this kind of negation: But I don't think this actually matters because there is a dedicated selector option for when you want to find pages that do or do not have a particular ancestor, and that is "has_parent": https://processwire.com/docs/selectors/#finding2 So rather than needing anything like... ...you can instead do... has_parent!=/foo/|/bar/|/baz/
  18. You have to first get the "itinerary" array as a variable distinct from the $session->itinerary overloaded property, modify it as needed, and then set it back to $session->itinerary. if(isset($_GET[$key])){ $itinerary = $session->itinerary; if(is_array($itinerary)) { // destroy a single element of an array unset($itinerary[$key]); $session->itinerary = $itinerary; $session->redirect($page->url); } }
  19. The module readme says:
  20. @neonwired, as explained a couple of posts above yours, you need to be using PW 3.0.166 or newer (currently on the PW dev branch) to install or upgrade to v0.3.2 of Connect Page Fields. If you don't want to use the PW dev version then you can manually download Connect Page Fields v0.3.1 by browsing back in the commit history: https://github.com/Toutouwai/ConnectPageFields/tree/99f5e06b959d100a57ab130fa6e6f57ffea19dc9 After you download make sure you rename the module folder from "ConnectPageFields-99f5e06b959d100a57ab130fa6e6f57ffea19dc9" to "ConnectPageFields" before you copy it to /site/modules/ and install it (see "Installing manually").
  21. @hollyvalero, after these posts were written a powerful truncate feature was added to the core as a sanitizer method. https://processwire.com/api/ref/sanitizer/truncate/ https://processwire.com/blog/posts/processwire-3.0.101-core-updates/
  22. FieldtypeDecimal uses InputfieldFloat as its inputfield, and it's the renderValue() method that determines what is shown when a field is not editable. So you could do this: $wire->addHookAfter('InputfieldFloat::renderValue', function(HookEvent $event) { /** @var InputfieldFloat $inputfield */ $inputfield = $event->object; $field = $inputfield->hasField; if($field && $field->name === 'your_field_name') { $event->return = '$' . number_format((float) $inputfield->value, 2); } });
  23. Welcome to the PW forums @virgomania! I don't believe that's possible. The PW core philosophy is to have images and files connected to the pages they are uploaded to and not in one central repository. In the past Ryan (lead developer of PW) has discussed why he favours this approach. Here's one old topic... ...and maybe others will chime in with links to more background on this subject. So a few suggestions: 1. Consider if you absolutely must have a central image/file repository. Maybe you could try the PW-way and you might find it works pretty well for 99% of cases. I think a lot of people new to PW first thought they needed a media library and then gradually learned that they didn't. ? 2. If your main use case is linking/inserting files or images into rich text (CKEditor) fields then be aware that you can link/insert images from any page, not only the current page. Some people even create one or more dedicated "library" pages which hold a lot of files/images that they use on other pages. The Media Library module can help with this. 3. If your main use case is dedicated fields which will hold files/images then have a look at the commercial Media Manager module. I think this module also allows you to link/insert the media in CKEditor fields. 4. You mentioned the Select Images inputfield (used together with Dynamic Options I assume). Because you supply the selectable images via a hook you can make images from multiple different pages selectable. Here's an example hook that would make images selectable from any image field on any page using the basic_page or home template: $wire->addHookAfter('FieldtypeDynamicOptions::getSelectableOptions', function(HookEvent $event) { // The Dynamic Options field $field = $event->arguments(1); // For a field named "select_images" if($field->name === 'select_images') { $options = []; // For each page that uses the basic_page or home template foreach($event->wire()->pages->find("template=basic_page|home") as $p) { // Get the FieldtypeImage fields that are in the page's template $image_fields = $p->fields->find("type=FieldtypeImage"); // For each image field foreach($image_fields as $field) { // Get the images stored on the page in that field $images = $p->getUnformatted($field->name); // For each image foreach($images as $image) { // Add a selectable option $options[$image->url] = "{$image->basename}<br>{$image->filesizeStr}"; } } } $event->return = $options; } }); But be aware that this won't scale infinitely. At some point the number of selectable images might be unmanageable and you may strike performance issues in the page editor. I think Media Manager might be more scalable in this respect.
  24. @rsi you can use $pages->sort() to set the sort value of the new page to zero after it is added, and that will make it appear at the top of its siblings but still be manually sortable. In /site/ready.php: $pages->addHookAfter('added', function(HookEvent $event) { $pages = $event->object; // The page that is being added $page = $event->arguments(0); // If the page passes some kind of test if($page->template == 'news_item') { // Set the sort value for the new page to zero (sibling sort will be automatically adjusted) $pages->sort($page, 0); } });
  25. If you just want to do this from time-to-time you can add a filter row like this: Or if you want the default limit to always be 50 (or whatever limit you want) then you can add a hook in /site/ready.php: $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { /** @var ProcessPageLister $lister */ $lister = $event->object; // Only for the "Find" lister if($event->wire()->page->name === 'lister') { $lister->defaultLimit = 50; } });
×
×
  • Create New...