robin-image-optimizer
/
libs
/
factory
/
core
/
includes
/
components
/
class-delete-component-button.php
class-delete-component-button.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WBCR\Factory_600\Components; |
| 4 | |
| 5 | /** |
| 6 | * This file groups the settings for quick setup |
| 7 | * |
| 8 | * @version 1.0 |
| 9 | */ |
| 10 | |
| 11 | // Exit if accessed directly |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | require_once 'class-install-component-button.php'; |
| 17 | |
| 18 | class Delete_Button extends Install_Button { |
| 19 | |
| 20 | public $plugin; |
| 21 | |
| 22 | /** |
| 23 | * @throws \Exception |
| 24 | */ |
| 25 | protected function build_wordpress() { |
| 26 | parent::build_wordpress(); |
| 27 | |
| 28 | $this->action = 'delete'; |
| 29 | $this->add_data( 'plugin-action', $this->action ); |
| 30 | $this->remove_class( 'button-primary' ); |
| 31 | } |
| 32 | |
| 33 | protected function build_internal() { |
| 34 | // nothing |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @param bool $echo |
| 39 | * |
| 40 | * @return string|void |
| 41 | */ |
| 42 | public function get_button() { |
| 43 | $button = '<a href="#" class="' . implode( ' ', $this->get_classes() ) . '" ' . implode( ' ', $this->get_data() ) . '><span class="dashicons dashicons-trash"></span></a>'; |
| 44 | |
| 45 | if ( $this->type == 'internal' || ! $this->is_plugin_install() || $this->is_plugin_activate() ) { |
| 46 | $button = ''; |
| 47 | } |
| 48 | |
| 49 | return $button; |
| 50 | } |
| 51 | } |
| 52 |