Forums

Can't make conditional appearance of the button

tempus 26 Sep, 2019
Hi

Please advice, how should I set up Table List tool.
I am going to make toggle button which have to show up "unpublish" on value 1, and "publish" on value 0.

My code in state field area looks like this, but does not work. I think the problem is mistake in element identifier $this->data['Data3']['state'] , because this is table and each row changes index number of the array
<?php
if ( $this->data['Data3']['state'] == "1" ) {
echo 'Unpublish';
} else {
echo 'Publish';
}
?>
Please, help to get it work
healyhatman 27 Sep, 2019
if ($this->data("Data3.state")) {
echo "Unpublish";
etc
tempus 27 Sep, 2019
Still can not get it work.
Is it possible to call {var:list_table#.row.Model.id} from custom php in the cell clause of Table List tool?

I am trying write like $this->get("list_table#.row.Model#.field") but does not work
tempus 27 Sep, 2019
Answer
Got it!

Made with Switcher area.
This topic is locked and no more replies can be posted.