__( 'webhook', 'woocommerce' ), 'plural' => __( 'webhooks', 'woocommerce' ), 'ajax' => false ) ); } /** * Get list columns * * @return array */ public function get_columns() { $columns = array( 'cb' => '', 'title' => __( 'Name', 'woocommerce' ), 'status' => __( 'Status', 'woocommerce' ), 'topic' => __( 'Topic', 'woocommerce' ), 'delivery_url' => __( 'Delivery URL', 'woocommerce' ), ); return $columns; } /** * Column cb. * * @param WC_Post $webhook * * @return string */ public function column_cb( $webhook ) { return sprintf( '', $this->_args['singular'], $webhook->ID ); } /** * Webhook columns. * * @param WC_Post $webhook * @param string $column_name * * @return string */ public function column_default( $webhook, $column_name ) { global $the_webhook; if ( empty( $the_webhook ) || $the_webhook->id != $webhook->ID ) { $the_webhook = new WC_Webhook( $webhook->ID ); } $output = ''; switch ( $column_name ) { case 'title' : $edit_link = get_edit_post_link( $the_webhook->id ); $title = _draft_or_post_title( $the_webhook->post_data ); $post_type_object = get_post_type_object( $the_webhook->post_data->post_type ); $output = '' . esc_html( $title ) . ''; // Get actions $actions = array(); $actions['id'] = sprintf( __( 'ID: %d', 'woocommerce' ), $the_webhook->id ); if ( current_user_can( $post_type_object->cap->edit_post, $the_webhook->id ) ) { $actions['edit'] = '' . __( 'Edit', 'woocommerce' ) . ''; } if ( current_user_can( $post_type_object->cap->delete_post, $the_webhook->id ) ) { if ( 'trash' == $the_webhook->post_data->post_status ) { $actions['untrash'] = '' . __( 'Restore', 'woocommerce' ) . ''; } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = '' . __( 'Trash', 'woocommerce' ) . ''; } if ( 'trash' == $the_webhook->post_data->post_status || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = '' . __( 'Delete Permanently', 'woocommerce' ) . ''; } } $actions = apply_filters( 'post_row_actions', $actions, $the_webhook->post_data ); $output .= '