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