Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/elemento.../modules/checklis.../data/endpoint...
File: steps.php
<?php
[0] Fix | Delete
namespace Elementor\Modules\Checklist\Data\Endpoints;
[1] Fix | Delete
[2] Fix | Delete
use Elementor\Data\V2\Base\Endpoint as Endpoint_Base;
[3] Fix | Delete
use Elementor\Modules\Checklist\Steps\Step_Base;
[4] Fix | Delete
use Elementor\Modules\Checklist\Steps_Manager;
[5] Fix | Delete
use Elementor\Modules\Checklist\Module as Checklist_Module;
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit; // Exit if accessed directly.
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
class Steps extends Endpoint_Base {
[12] Fix | Delete
[13] Fix | Delete
public function get_name(): string {
[14] Fix | Delete
return 'steps';
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public function get_format(): string {
[18] Fix | Delete
return 'checklist';
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
public function get_items( $request ) {
[22] Fix | Delete
return $this->get_checklist_data();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
public function update_item( $id, $request ) {
[26] Fix | Delete
$checklist_module = Checklist_Module::instance();
[27] Fix | Delete
$step = $checklist_module->get_steps_manager()->get_step_by_id( $id );
[28] Fix | Delete
$step->update_step( $request->get_json_params() );
[29] Fix | Delete
[30] Fix | Delete
return [
[31] Fix | Delete
'data' => 'success',
[32] Fix | Delete
];
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
private function get_checklist_data(): array {
[36] Fix | Delete
$checklist_module = Checklist_Module::instance();
[37] Fix | Delete
$steps_data = $checklist_module->get_steps_manager()->get_steps_for_frontend();
[38] Fix | Delete
[39] Fix | Delete
return [
[40] Fix | Delete
'data' => $steps_data,
[41] Fix | Delete
];
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
protected function register() {
[45] Fix | Delete
parent::register();
[46] Fix | Delete
[47] Fix | Delete
$this->register_item_route();
[48] Fix | Delete
$this->register_item_route( \WP_REST_Server::EDITABLE, [
[49] Fix | Delete
'id_arg_name' => 'id',
[50] Fix | Delete
'id_arg_type_regex' => '[\w\-\_]+',
[51] Fix | Delete
'id' => [
[52] Fix | Delete
'type' => 'string',
[53] Fix | Delete
'description' => 'The step id.',
[54] Fix | Delete
'required' => true,
[55] Fix | Delete
'validate_callback' => function ( $step_id ) {
[56] Fix | Delete
return in_array( $step_id, Steps_Manager::get_step_ids() );
[57] Fix | Delete
},
[58] Fix | Delete
],
[59] Fix | Delete
] );
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function