Jump to content

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


nik
 Share

Recommended Posts

Thanks adrian!

I actually thought I had fixed that months ago... And I had, but the changes unfortunately never made their way into GitHub until now.

Anyways, multi-lingual titles are now fixed. Also, I pushed a little new feature as well: now you're able to choose a role and page permissions are shown for that role for each listed page. Hovering those yes/no texts gives a short explanation (as the titles are just single letters to keep it compact).

  • Like 3
Link to comment
Share on other sites

  • 8 months later...

I get an error, if I try to find users based on roles like this.

template=user,roles*=candidate
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='candidate' JOIN field_roles AS field_roles ON field_roles.pages_id=pages.id A' at line 3

Greetings,

Benjamin

Link to comment
Share on other sites

Hi Benjamin!

That kind of selector is not supported in the core apart from dev version. I'm not sure exactly when selectors have been updated to allow wildcard search to the names of pages via a page reference (which "roles" is), but that seems to work in the latest dev at least.

Then again, the module doesn't handle these kind of errors too good - you need to logout and login again to get rid of the error as the selector is saved in the session. Maybe I should try and find a better way as I've been tripped by this behavior myself a couple of times as well. :)

But meanwhile, and to achieve what you were trying to do, update the PW core if possible. That should do it.

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...

Hi, this has been a favorite module of mine, but I'm finding that it doesn't work with v2.5 (specifically 2.5.3).

I get this error when loading /setup/selector-test/:

Error: Call to a member function getArray() on a non-object (line 700 of /Develop/Source/site/modules/ProcessSelectorTest/ProcessSelectorTest.module)

Is there another way to do this using Lister that I don't know about?

Thanks.

Link to comment
Share on other sites

  • 1 year later...
4 minutes ago, gmclelland said:

I already had Tracy Debugger installed, but didn't know about this.  Very nice, thanks szabesz!

Just an FYI, when using the console, d() is usually more useful than bd() as it will put the results at the bottom of the console panel, rather than needing to open the dumps panel to see the results.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

If anyone is interested, I just pushed a couple of updates to my fork of Nik's excellent module.

This version adds logging of selector string and the result summary - something I was missing as I'd kind of play with the string, hit a selector that worked for me and promptly loose it by fiddling some more with it.

selector-test-002.png

You need to look in the log (or use the log viewer) to find the previous strings - but at least they are there.

Additionally, the forked version adds a hook to allow custom titles to be generated for repeater fields (Shown below with custom titles for the relationships repeater)

selector-test-001.png

The code to produce the custom label being...

/**
 * Custom hook to format repeater field labels in ProcessSelectorTest results...
 *
 * Turns labels from ... to => ... this
 *
 *              '0'       =>      '0 Parent of: Jack, Jane, Jill'
 *              '1'       =>      '1 Coach of: Anne, Benjamin, Connie, Dick, Emily, Faith, Gill'
 *              '2'       =>      '2 Spouse of: Richard'
 */
$pages->addHookAfter('ProcessSelectorTest::formatRepeaterLabel', function($event) {
    $replabel     = $event->return;
    $parent_field = $event->arguments(0);
    $repeater     = $event->arguments(1);

    if ('relationships' == $parent_field->name) {
        if ($repeater->people) {
            $replabel .= ': ' . $repeater->people->implode(', ', 'title');
        }
    }

    $event->return = $replabel;
});

 

I'll issue a pull request to Nik - but he's not been particularly active here recently.

  • Like 4
Link to comment
Share on other sites

Nice work Steve!

5 minutes ago, netcarver said:

You need to look in the log (or use the log viewer) to find the previous strings - but at least they are there.

Sounds like a perfect use case for the log viewer in Tracy :)

  • 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...