Use new code style
This commit is contained in:
@ -32,8 +32,7 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent get_items to add a total line.
|
||||
@ -52,14 +51,11 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
$products = $membership->get_all_products();
|
||||
|
||||
if ($count) {
|
||||
|
||||
return count($products);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $products;
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -77,25 +73,26 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
|
||||
$item = $item['product'];
|
||||
|
||||
if (!$item) {
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'url' => false,
|
||||
'id' => 'not-found',
|
||||
'title' => __('Product not found', 'wp-ultimo'),
|
||||
'status' => '',
|
||||
'image' => $this->column_featured_image_id(new \WP_Ultimo\Models\Product()),
|
||||
), array(
|
||||
'quantity' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Quantity', 'wp-ultimo'),
|
||||
'value' => sprintf(__('x%d', 'wp-ultimo'), $quantity),
|
||||
if ( ! $item) {
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'url' => false,
|
||||
'id' => 'not-found',
|
||||
'title' => __('Product not found', 'wp-ultimo'),
|
||||
'status' => '',
|
||||
'image' => $this->column_featured_image_id(new \WP_Ultimo\Models\Product()),
|
||||
),
|
||||
));
|
||||
array(
|
||||
'quantity' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Quantity', 'wp-ultimo'),
|
||||
'value' => sprintf(__('x%d', 'wp-ultimo'), $quantity),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$first_row = array(
|
||||
'quantity' => array(
|
||||
@ -119,46 +116,50 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
);
|
||||
|
||||
if ($item->get_type() === 'plan') {
|
||||
|
||||
$first_row['change'] = array(
|
||||
'wrapper_classes' => 'wubox',
|
||||
'icon' => 'dashicons-wu-edit1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => __('Upgrade or Downgrade', 'wp-ultimo'),
|
||||
'url' => wu_get_form_url('change_membership_plan', array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)),
|
||||
'url' => wu_get_form_url(
|
||||
'change_membership_plan',
|
||||
array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$first_row['remove'] = array(
|
||||
'wrapper_classes' => 'wu-text-red-500 wubox',
|
||||
'icon' => 'dashicons-wu-trash-2 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => __('Remove', 'wp-ultimo'),
|
||||
'url' => wu_get_form_url('remove_membership_product', array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)),
|
||||
'url' => wu_get_form_url(
|
||||
'remove_membership_product',
|
||||
array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_name(),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_name(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-product',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
);
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Membership_Line_Item_List_Table;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user