PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.3
Elementor Website Builder – more than just a page builder v4.2.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / checklist / data / endpoints / steps.php

steps.php in Elementor Website Builder – more than just a page builder 4.2.3, at modules/checklist/data/endpoints/steps.php

64 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Checklist\Data\Endpoints;
3
4 use Elementor\Data\V2\Base\Endpoint as Endpoint_Base;
5 use Elementor\Modules\Checklist\Steps\Step_Base;
6 use Elementor\Modules\Checklist\Steps_Manager;
7 use Elementor\Modules\Checklist\Module as Checklist_Module;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Steps extends Endpoint_Base {
14
15 public function get_name(): string {
16 return 'steps';
17 }
18
19 public function get_format(): string {
20 return 'checklist';
21 }
22
23 public function get_items( $request ) {
24 return $this->get_checklist_data();
25 }
26
27 public function update_item( $id, $request ) {
28 $checklist_module = Checklist_Module::instance();
29 $step = $checklist_module->get_steps_manager()->get_step_by_id( $id );
30 $step->update_step( $request->get_json_params() );
31
32 return [
33 'data' => 'success',
34 ];
35 }
36
37 private function get_checklist_data(): array {
38 $checklist_module = Checklist_Module::instance();
39 $steps_data = $checklist_module->get_steps_manager()->get_steps_for_frontend();
40
41 return [
42 'data' => $steps_data,
43 ];
44 }
45
46 protected function register() {
47 parent::register();
48
49 $this->register_item_route();
50 $this->register_item_route( \WP_REST_Server::EDITABLE, [
51 'id_arg_name' => 'id',
52 'id_arg_type_regex' => '[\w\-\_]+',
53 'id' => [
54 'type' => 'string',
55 'description' => 'The step id.',
56 'required' => true,
57 'validate_callback' => function ( $step_id ) {
58 return in_array( $step_id, Steps_Manager::get_step_ids() );
59 },
60 ],
61 ] );
62 }
63 }
64