delete-page-action.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Admin\Single_Pages\Actions; |
| 5 | |
| 6 | use Jet_Form_Builder\Admin\Buttons\Base_Vui_Button; |
| 7 | |
| 8 | // If this file is called directly, abort. |
| 9 | if ( ! defined( 'WPINC' ) ) { |
| 10 | die; |
| 11 | } |
| 12 | |
| 13 | abstract class Delete_Page_Action extends Base_Rest_Page_Action { |
| 14 | |
| 15 | public function get_slug(): string { |
| 16 | return 'delete'; |
| 17 | } |
| 18 | |
| 19 | public function get_position(): string { |
| 20 | return self::PRIMARY; |
| 21 | } |
| 22 | |
| 23 | public function get_payload(): array { |
| 24 | return array( |
| 25 | 'redirect' => jet_fb_current_page()->get_parent()->get_url(), |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @return Base_Vui_Button |
| 31 | */ |
| 32 | public function get_button(): Base_Vui_Button { |
| 33 | $button = parent::get_button(); |
| 34 | $button->set_label( __( 'Delete', 'jet-form-builder' ) ); |
| 35 | $button->set_size( $button::SIZE_MINI_X2 ); |
| 36 | $button->set_style( $button::STYLE_ACCENT_ERROR ); |
| 37 | |
| 38 | return $button; |
| 39 | } |
| 40 | } |
| 41 |