Jump to content

Module: Testrun selectors + find() from admin (ProcessSelectorTest)


nik
 Share

Recommended Posts

This module creates a page in the ProcessWire admin where you can test selectors and browse page data and properties without editing a template file or a bootstrapped script.

Given selector string is used as is to find pages - only limit is added, if given. Errors are catched and displayed so anything can be tested. Pages found with a valid selector are listed (id, title) with links to the page.

I was thinking this would be useful for someone new to ProcessWire, but it turns out I'm using it myself all the time. Maybe someone else finds it useful as well. :)

Module can be downloaded here: https://github.com/n...essSelectorTest

Modules directory: http://modules.processwire.com/modules/process-selector-test/

Features

  • Edit selector string and display results (and possible errors as reported by ProcessWire)
  • Explore properties and data of matching pages in a tree view
    • Language aware: multi-language and language-alternate fields supported
    • Repeater fields and values
    • Images and their variations on disk
    • More data is loaded on-demand as the tree is traversed deeper
  • Quick links to edit/view pages, edit templates and run new selectors (select pages with the same template or children of a page)
  • Page statuses visualized like in default admin theme
  • Add pagination

Screenshots
post-481-0-82978600-1352735950_thumb.pngpost-481-0-58536800-1352735952_thumb.pngpost-481-0-98417000-1352735953_thumb.pngpost-481-0-40919900-1352735955_thumb.png

  • Like 15
Link to comment
Share on other sites

  • 1 month later...

Just made version 1.1 of this module available (GitHub).

Changes (additions actually) in latest version:

  • Explore properties and data of matching pages in a tree view
    • Language aware: multi-language and language-alternate fields supported
    • Repeater fields and values
    • Images and their variations on disk
    • More data is loaded on-demand as the tree is traversed deeper

    [*]Quick links to edit/view pages, edit templates and run new selectors (select pages with the same template or children of a page)

    [*]Page statuses visualized like in default admin theme

I'll update the first post in this thread and include some screenshots there as well.

  • Like 8
Link to comment
Share on other sites

  • 4 weeks later...

What an excellent idea! Thanks a lot! I think it's a msut have for beginners like me. I was often confronted to this kind of doubt : are my 'find' parameters correct or do I have problem somewhere else in my code? I guess now I'll be able to get rid of those doubts regarding the find parameters.

Great!

Link to comment
Share on other sites

  • 1 month later...

I was planning to add something a bit more at once, but as there never seems to be enough time I decided to release what I had ready. Just pushed these minor improvements to GitHub.

Version 1.11:

  • Added: all field and template data shown + cached at template level
  • Added: fields inside a fieldset are wrapped into a new subtree (page data only - fields inside a template are in a flat list)
  • Like 3
Link to comment
Share on other sites

Thanks again nik for this Module :)

I've just gone to update to 1.1.1 from 1.1.0 but it seems like the download (via git or via Modules Manager) always gets 1.1.0 and so Modules Manger keeps reporting that there is a 'new version available'.

Or is this something silly I am doing?

  • Like 1
Link to comment
Share on other sites

@alanfluff: It must have been because of the version number - I had forgotten to update it in the source. It should be fine now, just pushed the update to GitHub. Sorry!

I hope the actual updates are in place though :P.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I'm posting this here, but I this problem maybe goes beyond the module itself. While using the selector test I was having some "Trying to get property of non-object" errors. I manage to track it down to, every time the selector test retrieves pages with an empty, single-page, radio field on their templates. I modified the radio to multiple, and the error stopped. I don't get the error while using the same selectors in the frontend, so It's some property that is being called on the fields inside the foreach made by the selectors test.

To reproduce the error:

  • Create a page field and set it to single page (choose whatever template or parent to populate it).
  • Add it to a template.
  • Create a page with that template without selecting any option for the page field.
  • Go to Selector test and test for a selector that would retrieve that page.
  • Like 1
Link to comment
Share on other sites

Thanks for the report diogo! Your good explanation made it really easy to spot the problem. There clearly was a bug with single page Page fields: they were not handled correctly at all. :)

The bug is now fixed and version 1.1.2 of the module has been released.

  • Like 2
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

×
×
  • Create New...