Can't make conditional appearance of the button

How to conditionally display a publish/unpublish button in a table list.

Overview

The issue occurred because the PHP code incorrectly referenced array indices that change with each table row.
Use the Switcher area tool instead of custom PHP code to toggle button text based on the state field value.

Answered
ChronoForms v6
te 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
he healyhatman 27 Sep, 2019
if ($this->data("Data3.state")) {
echo "Unpublish";
etc
te 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
te tempus 27 Sep, 2019
Answer
Got it!

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