Better Workflow: Now we’re Playa-ing nicely

It's full steam ahead at Putty Towers to finish all the features we want to pack in to our first release of Better Workflow, and our target this week has been Playa.

We sized it up from several different angles and had a good root around under the bonnet (that's hood to our American friends). There's some super fly code in there but unfortunately not a hook in sight and without one there's simply no way to generate a preview.

Messing with other people's code is never ideal, but right now it's the only way to get Better Workflow to play nicely with Playa.

Taking the principle of the existing and super handy matrix_data_query hook, which gives you the opportunity to alter the data sent to the template, we have rolled our own equivalent for Playa and dropped it into the _fetch_rels() method at line 409 of mod.playa.php.

The implementation looks like this:

// -------------------------------------------
if ($this->EE->extensions->active_hook('playa_data_query'))
{
$rels = $this->EE->extensions->call('playa_data_query', $dir, $this->entry_id, $field_ids, $col_ids, $row_ids, $rels);
}
// -------------------------------------------

It's not the most efficient code ever created as you have to run the original query even if you then go off any get your data from somewhere else, but we wanted to make the smallest change possible to the add-on.

Download

Categories

Words, Development

Metadata

2 comments

2 comments

Jean St-Amand

Keenly interested to see this add-on in the wild.  Do you have a target release date?  I have a project coming up that it would likely be great for.  Workflow for EE2 is a big space that needs filling!

Travis

Have you asked Pixel&Tonic; to add the hook to playa officially? He’s usually very responsive (sometimes that response is no, of course ;) )

TTFN
Travis

Leave a comment

Which of pink, dress, library, shorts or jelly is a colour?