__('Webhook', 'wp-ultimo'), // singular name of the listed records
'plural' => __('Webhooks', 'wp-ultimo'), // plural name of the listed records
'ajax' => true, // does this table support ajax?
'add_new' => array(
'url' => wu_get_form_url('add_new_webhook_modal'),
'classes' => 'wubox',
),
));
} // end __construct;
/**
* Displays the content of the name column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
*/
public function column_name($item): string {
$url_atts = array(
'id' => $item->get_id(),
'model' => 'webhook',
);
$title = sprintf('%s
%s', wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts), $item->get_name(), $item->get_id(), __('Sending Test..', 'wp-ultimo'));
$actions = array(
'edit' => sprintf('%s', wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts), __('Edit', 'wp-ultimo')),
'test' => sprintf('%s', $item->get_webhook_url(), __('Send Test', 'wp-ultimo')),
'delete' => sprintf(
'%s',
__('Delete', 'wp-ultimo'),
wu_get_form_url(
'delete_modal',
$url_atts
),
__('Delete', 'wp-ultimo')
),
);
return $title . $this->row_actions($actions);
} // end column_name;
/**
* Displays the content of the webhook url column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
* @return string
*/
public function column_webhook_url($item) {
$trimmed_url = mb_strimwidth((string) $item->get_webhook_url(), 0, 50, '...');
return "{$trimmed_url}";
} // end column_webhook_url;
/**
* Displays the content of the event column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
* @return string
*/
public function column_event($item) {
$event = $item->get_event();
return "{$event}";
} // end column_event;
/**
* Displays the content of the count column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
*/
public function column_count($item): string {
$count = $item->get_count();
$actions = array(
'edit' => sprintf('%s', '', __('See Events', 'wp-ultimo')),
);
return $count . $this->row_actions($actions);
} // end column_count;
/**
* Displays the content of the integration column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
*/
public function column_integration($item): string {
return ucwords(str_replace(array('_', '-'), ' ', (string) $item->get_integration()));
} // end column_integration;
/**
* Displays the content of the active column.
*
* @since 2.0.0
*
* @param WP_Ultimo\Models\Webhook $item Webhook object.
* @return string
*/
public function column_active($item) {
return $item->is_active() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo');
} // end column_active;
/**
* Returns the list of columns for this particular List Table.
*
* @since 2.0.0
* @return array
*/
public function get_columns() {
$columns = array(
'cb' => '',
'name' => __('Name', 'wp-ultimo'),
'webhook_url' => __('Target URL', 'wp-ultimo'),
'event' => __('Trigger Event', 'wp-ultimo'),
'event_count' => __('Count', 'wp-ultimo'),
'integration' => __('Integration', 'wp-ultimo'),
'active' => __('Active', 'wp-ultimo'),
'id' => __('ID', 'wp-ultimo'),
);
return $columns;
} // end get_columns;
/**
* Returns the filters for this page.
*
* @since 2.0.0
*/
public function get_filters(): array {
return array(
'filters' => array(),
'date_filters' => array(),
);
} // end get_filters;
} // end class Webhook_List_Table;