Skip to content

Commit

Permalink
action column - third party plugin support start from action column
Browse files Browse the repository at this point in the history
  • Loading branch information
codersaiful committed Jan 12, 2023
1 parent 4b0b701 commit 828b1b7
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 3 deletions.
3 changes: 3 additions & 0 deletions admin/admin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace WOO_PRODUCT_TABLE\Admin;

use WOO_PRODUCT_TABLE\Core\Base;
use WOO_PRODUCT_TABLE\Admin\Handle\Feature_Loader;
use WOO_PRODUCT_TABLE\Admin\Handle\Pro_Version_Update;
use WOO_PRODUCT_TABLE\Admin\Handle\Deactive_Form as Old_Deactive_Form;
use WOO_PRODUCT_TABLE\Admin\Handle\Plugin_Deactive\Deactive_Form;
Expand All @@ -14,6 +15,8 @@ public function __construct(){
$pro_update_ntc = new Pro_Version_Update();
$pro_update_ntc->run();

$features = new Feature_Loader();
$features->run();

}
}
53 changes: 53 additions & 0 deletions admin/handle/action-feature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
namespace WOO_PRODUCT_TABLE\Admin\Handle;

use WOO_PRODUCT_TABLE\Core\Base;

/**
* Adding new Feature for Admin Action Column
*
*
*/
class Action_Feature extends Base
{
public function run()
{
//Any one can use
// $this->action('wpto_column_setting_form_action',2, 10, 'third_party_switch' );
add_action( 'wpto_column_setting_form_action', [$this, 'third_party_switch'], 10, 5 );

}

public function third_party_switch( $_device_name, $column_settings, $columns_array, $updated_columns_array, $post )
{
$post_id = $post->ID;
$conditions = get_post_meta($post_id,'conditions',true);
$table_type = $conditions['table_type'] ?? '';

$third_party_plugin = $column_settings['action']['third_party_plugin'] ?? '';
if( empty($third_party_plugin) && $table_type === 'advance_table'){
$third_party_plugin = 'advance_table';
}

$third_party_plugin_checkbox = $third_party_plugin == 'advance_table' ? 'checked="checked"' : '';

?>
<label
title="<?php echo esc_attr__( 'Actually this will override the same option from Option tab.', 'woo-product-table' ); ?>"
for="third_party_plugin<?php echo esc_attr( $_device_name ); ?>">
<input id="third_party_plugin<?php echo esc_attr( $_device_name ); ?>"

name="column_settings<?php echo esc_attr( $_device_name ); ?>[action][third_party_plugin]"
id="third_party_plugin"
class="third_party_plugin"
value="advance_table"
type="checkbox" <?php echo esc_attr( $third_party_plugin_checkbox ); ?>>

<?php echo esc_html__( 'Third Party Plugin Supporting', 'woo-product-table' ); ?>
</label>
<?php
wpt_help_icon_render( __('If any feature do not work for Add To Cart Button, Enable this feature.', 'woo-product-table') );
?>
<?php
}
}
24 changes: 24 additions & 0 deletions admin/handle/feature-loader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace WOO_PRODUCT_TABLE\Admin\Handle;

/**
* All feature handle/control will from here
*
*
* Such:
* action-feature
* other
*
* Even we will transfer other feature which currently available in functions.php file
*
* @since 3.3.6.0
* @author Saiful Islam <codersaiful@gmail.com>
*/
class Feature_Loader
{
public function run()
{
$action = new Action_Feature();
$action->run();
}
}
9 changes: 7 additions & 2 deletions admin/tabs/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,13 @@ class="wpt_data_filed_atts ua_input"
</tr>


<!--
actually ei option ta mai action column a niye gechi.
location: admin/handle/feature-loader.php
location: admin/handle/action-feature.php
-->

<tr>
<!-- <tr>
<th>
<label class="wpt_label" for="wpt_table_table_type"><?php esc_html_e( 'Third Party Plugin Supporting ', 'woo-product-table' ); ?></label>
</th>
Expand All @@ -313,7 +318,7 @@ class="wpt_data_filed_atts ua_input"

</select>
</td>
</tr>
</tr> -->

<tr>
<th>
Expand Down
19 changes: 18 additions & 1 deletion inc/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ public function assing_property( $atts ){


$this->posts_per_page = $this->conditions['posts_per_page'] ?? $this->posts_per_page;
$this->table_type = $this->conditions['table_type'] ?? $this->table_type;


//Some Basic Meta Values | All other query related available in Args Class
$this->table_head = ! isset( $this->basics['table_head'] ) ? true : false;
Expand Down Expand Up @@ -643,6 +643,23 @@ public function assing_property( $atts ){

$this->column_settings = apply_filters( 'wpto_column_settings', $column_settings, $this->table_id, $this->_enable_cols );

/**
* Actually this option has come from condition tab
* in old version,
* Now I have changed it and transfer to Action column.
*
* ---------------
* This was from options tab
* now come from
* admin/handle/feature-loader.php
* admin/handle/action-feature.php
*
* @since 3.3.6
* @author Saiful Islam <codersaiful@gmail.com>
*/
$third_table_type = $this->conditions['table_type'] ?? $this->table_type;
$this->table_type = $this->column_settings['action']['third_party_plugin'] ?? $third_table_type;

/**
* Column Management Here
*/
Expand Down

0 comments on commit 828b1b7

Please sign in to comment.