| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Modules\Form_Record\Admin\View_Columns; |
| 5 |
|
| 6 |
use Jet_Form_Builder\Admin\Table_Views\Column_Advanced_Base; |
| 7 |
use Jet_Form_Builder\Form_Messages\Status_Info; |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
class Status_Column extends Column_Advanced_Base { |
| 15 |
|
| 16 |
protected $type = self::STATUS; |
| 17 |
protected $column = 'status'; |
| 18 |
|
| 19 |
public function get_label(): string { |
| 20 |
return __( 'Status', 'jet-form-builder' ); |
| 21 |
} |
| 22 |
|
| 23 |
public function get_value( array $record = array() ) { |
| 24 |
$status = parent::get_value( $record ); |
| 25 |
$status = empty( $status ) ? 'failed' : $status; |
| 26 |
|
| 27 |
$info = new Status_Info( $status ); |
| 28 |
|
| 29 |
return array( |
| 30 |
'type' => $info->is_success() ? self::STATUS_SUCCESS : self::STATUS_FAILED, |
| 31 |
'text' => $info->get_message(), |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|