Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2016-11-15 12:12:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: tom_image_grid : Grid UI for images tab

RedFox wrote #302887:

the UI of smd_thumbnail in Txp 4.6.x could have some beautifying.

Drop me an issue and explain (or better still, provide a mockup for) a better system and I’ll see what I can do.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#26 2016-11-15 14:33:33

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: tom_image_grid : Grid UI for images tab

etc wrote #302881:

In 4.5 the last plugin using pluggable_ui trashed the others output.

No, I was wrong: in 4.5 plugins sharing the same pluggable_ui and wishing to extend the default ui caused multiple default ui output. But this was not a problem when the default is empty (like here). Should we restore this behavior?

Offline

#27 2016-11-15 14:47:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: tom_image_grid : Grid UI for images tab

etc wrote #302893:

in 4.5 plugins sharing the same pluggable_ui and wishing to extend the default ui caused multiple default ui output. But this was not a problem when the default is empty (like here). Should we restore this behavior?

Is it possible to have the best of both worlds? Plugins automatically co-exist without duplication of previous UI output (plugin load order can determine which appears ‘first’ if two share the same pluggable_ui() hook) and also work even if the default is empty. Not sure what’s involved here.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#28 2016-11-15 15:14:45

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: tom_image_grid : Grid UI for images tab

Say, you have two plugins appending something to Custom fields pane on Write tab:

register_callback( 'abc_append', 'article_ui', 'custom_fields');
function abc_append($event, $step, $default)
{
    return $default . 'Append me!';
}

and

register_callback( 'def_append', 'article_ui', 'custom_fields');
function def_append($event, $step, $default)
{
    return $default . 'Append me!';
}

Separately, each one will output

...custom fields pane...
Append me!

But if they are both enabled, in 4.5 you’ll get (whatever order) the wrong

...custom fields pane...
Append me!
...custom fields pane...
Append me!

In 4.6 they correctly produce

...custom fields pane...
Append me!
Append me!

This happens because 4.5 chains plugins output, while 4.6 resets $default to the previous plugin output when passing it to the next one and outputs the last plugin result. The problem is that if both ignore $default, echoing just “Append me!”, in 4.5 this gives

Append me!
Append me!

but in 4.6 only the last

Append me!

Since pluggable_ui() does not know what plugins do with $default, it can not choose the best solution in general. But if $default is empty, we can reasonably presume that 4.5 output is more natural.

Last edited by etc (2016-11-15 15:46:14)

Offline

#29 2016-11-15 15:37:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: tom_image_grid : Grid UI for images tab

@etc: sounds reasonable to me.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#30 2017-09-08 12:39:18

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: tom_image_grid : Grid UI for images tab

smd_thumbnail 0.4.0 doesn’t play nice at all with tom_image_grid (0.4) on Txp 4.6.2 … or visa versa … :(

Offline

#31 2017-09-08 13:11:59

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: tom_image_grid : Grid UI for images tab

Right. Steph has open a issue on github.
Update soon.

Offline

#32 2017-09-08 13:19:03

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: tom_image_grid : Grid UI for images tab

Yes, I know … but the ‘problem’ has become much ‘bigger’.

Last edited by RedFox (2017-09-08 13:21:14)

Offline

#33 2017-09-11 16:58:04

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: tom_image_grid : Grid UI for images tab

I’m currently working on an update of this plugin.
A better cohabitation with smd_thumbnail 0.4beta.

if I understand the previous messages :
smd_thumbnail and tom_image_grid use the same pluggable-ui point.
I played with load order prefs.

  • If the 2 plugins have the same value. Only tom_ig is loaded. Because Txp load plugins by alphabetic order ?
  • If tom_ig has a highter value than smd_thumb, only tom_ig is loaded.
  • if tom_ig has a lower value than smd_thumb, the two plugins are loaded. Why in this order it’s ok and not in other way/direction ?

Can I have to change something in my plugin to make things more logical?

Last edited by sacripant (2017-09-11 16:59:29)

Offline

#34 2017-09-12 10:34:34

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: tom_image_grid : Grid UI for images tab

Not sure, but try to replace

function tom_image_grid_markup()
{
    $out = ...
    echo $out;
}

with

function tom_image_grid_markup($event, $step, $default)
{
    $out = ...
    echo $default.$out;
}

Offline

#35 2017-09-18 13:13:02

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: tom_image_grid : Grid UI for images tab

Yeh! Bingo.
I upgrade and publish. Thx Oleg.

Offline

#36 2017-09-18 14:13:00

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: tom_image_grid : Grid UI for images tab

0.4.2 is out

  • Compatibility with smd_thumbnail. Thanks to Bloke and etc.
  • Some CSS and SVG optimisations

Download and Sources

Website

Offline

Board footer

Powered by FluxBB