abstract-wc-rest-crud-controller.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <?php
  2. /**
  3. * Abstract Rest CRUD Controller Class
  4. *
  5. * @class WC_REST_CRUD_Controller
  6. * @package WooCommerce/Abstracts
  7. * @version 3.0.0
  8. */
  9. if ( ! defined( 'ABSPATH' ) ) {
  10. exit;
  11. }
  12. /**
  13. * WC_REST_CRUD_Controller class.
  14. *
  15. * @extends WC_REST_Posts_Controller
  16. */
  17. abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller {
  18. /**
  19. * Endpoint namespace.
  20. *
  21. * @var string
  22. */
  23. protected $namespace = 'wc/v2';
  24. /**
  25. * If object is hierarchical.
  26. *
  27. * @var bool
  28. */
  29. protected $hierarchical = false;
  30. /**
  31. * Get object.
  32. *
  33. * @param int $id Object ID.
  34. * @return object WC_Data object or WP_Error object.
  35. */
  36. protected function get_object( $id ) {
  37. // translators: %s: Class method name.
  38. return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
  39. }
  40. /**
  41. * Check if a given request has access to read an item.
  42. *
  43. * @param WP_REST_Request $request Full details about the request.
  44. * @return WP_Error|boolean
  45. */
  46. public function get_item_permissions_check( $request ) {
  47. $object = $this->get_object( (int) $request['id'] );
  48. if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'read', $object->get_id() ) ) {
  49. return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
  50. }
  51. return true;
  52. }
  53. /**
  54. * Check if a given request has access to update an item.
  55. *
  56. * @param WP_REST_Request $request Full details about the request.
  57. * @return WP_Error|boolean
  58. */
  59. public function update_item_permissions_check( $request ) {
  60. $object = $this->get_object( (int) $request['id'] );
  61. if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'edit', $object->get_id() ) ) {
  62. return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
  63. }
  64. return true;
  65. }
  66. /**
  67. * Check if a given request has access to delete an item.
  68. *
  69. * @param WP_REST_Request $request Full details about the request.
  70. * @return bool|WP_Error
  71. */
  72. public function delete_item_permissions_check( $request ) {
  73. $object = $this->get_object( (int) $request['id'] );
  74. if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) {
  75. return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
  76. }
  77. return true;
  78. }
  79. /**
  80. * Get object permalink.
  81. *
  82. * @param object $object Object.
  83. * @return string
  84. */
  85. protected function get_permalink( $object ) {
  86. return '';
  87. }
  88. /**
  89. * Prepares the object for the REST response.
  90. *
  91. * @since 3.0.0
  92. * @param WC_Data $object Object data.
  93. * @param WP_REST_Request $request Request object.
  94. * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
  95. */
  96. protected function prepare_object_for_response( $object, $request ) {
  97. // translators: %s: Class method name.
  98. return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
  99. }
  100. /**
  101. * Prepares one object for create or update operation.
  102. *
  103. * @since 3.0.0
  104. * @param WP_REST_Request $request Request object.
  105. * @param bool $creating If is creating a new object.
  106. * @return WP_Error|WC_Data The prepared item, or WP_Error object on failure.
  107. */
  108. protected function prepare_object_for_database( $request, $creating = false ) {
  109. // translators: %s: Class method name.
  110. return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
  111. }
  112. /**
  113. * Get a single item.
  114. *
  115. * @param WP_REST_Request $request Full details about the request.
  116. * @return WP_Error|WP_REST_Response
  117. */
  118. public function get_item( $request ) {
  119. $object = $this->get_object( (int) $request['id'] );
  120. if ( ! $object || 0 === $object->get_id() ) {
  121. return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
  122. }
  123. $data = $this->prepare_object_for_response( $object, $request );
  124. $response = rest_ensure_response( $data );
  125. if ( $this->public ) {
  126. $response->link_header( 'alternate', $this->get_permalink( $object ), array( 'type' => 'text/html' ) );
  127. }
  128. return $response;
  129. }
  130. /**
  131. * Save an object data.
  132. *
  133. * @since 3.0.0
  134. * @param WP_REST_Request $request Full details about the request.
  135. * @param bool $creating If is creating a new object.
  136. * @return WC_Data|WP_Error
  137. */
  138. protected function save_object( $request, $creating = false ) {
  139. try {
  140. $object = $this->prepare_object_for_database( $request, $creating );
  141. if ( is_wp_error( $object ) ) {
  142. return $object;
  143. }
  144. $object->save();
  145. return $this->get_object( $object->get_id() );
  146. } catch ( WC_Data_Exception $e ) {
  147. return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
  148. } catch ( WC_REST_Exception $e ) {
  149. return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  150. }
  151. }
  152. /**
  153. * Create a single item.
  154. *
  155. * @param WP_REST_Request $request Full details about the request.
  156. * @return WP_Error|WP_REST_Response
  157. */
  158. public function create_item( $request ) {
  159. if ( ! empty( $request['id'] ) ) {
  160. /* translators: %s: post type */
  161. return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) );
  162. }
  163. $object = $this->save_object( $request, true );
  164. if ( is_wp_error( $object ) ) {
  165. return $object;
  166. }
  167. try {
  168. $this->update_additional_fields_for_object( $object, $request );
  169. } catch ( WC_Data_Exception $e ) {
  170. $object->delete();
  171. return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
  172. } catch ( WC_REST_Exception $e ) {
  173. $object->delete();
  174. return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  175. }
  176. /**
  177. * Fires after a single object is created or updated via the REST API.
  178. *
  179. * @param WC_Data $object Inserted object.
  180. * @param WP_REST_Request $request Request object.
  181. * @param boolean $creating True when creating object, false when updating.
  182. */
  183. do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, true );
  184. $request->set_param( 'context', 'edit' );
  185. $response = $this->prepare_object_for_response( $object, $request );
  186. $response = rest_ensure_response( $response );
  187. $response->set_status( 201 );
  188. $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $object->get_id() ) ) );
  189. return $response;
  190. }
  191. /**
  192. * Update a single post.
  193. *
  194. * @param WP_REST_Request $request Full details about the request.
  195. * @return WP_Error|WP_REST_Response
  196. */
  197. public function update_item( $request ) {
  198. $object = $this->get_object( (int) $request['id'] );
  199. if ( ! $object || 0 === $object->get_id() ) {
  200. return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 400 ) );
  201. }
  202. $object = $this->save_object( $request, false );
  203. if ( is_wp_error( $object ) ) {
  204. return $object;
  205. }
  206. try {
  207. $this->update_additional_fields_for_object( $object, $request );
  208. } catch ( WC_Data_Exception $e ) {
  209. return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
  210. } catch ( WC_REST_Exception $e ) {
  211. return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  212. }
  213. /**
  214. * Fires after a single object is created or updated via the REST API.
  215. *
  216. * @param WC_Data $object Inserted object.
  217. * @param WP_REST_Request $request Request object.
  218. * @param boolean $creating True when creating object, false when updating.
  219. */
  220. do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, false );
  221. $request->set_param( 'context', 'edit' );
  222. $response = $this->prepare_object_for_response( $object, $request );
  223. return rest_ensure_response( $response );
  224. }
  225. /**
  226. * Prepare objects query.
  227. *
  228. * @since 3.0.0
  229. * @param WP_REST_Request $request Full details about the request.
  230. * @return array
  231. */
  232. protected function prepare_objects_query( $request ) {
  233. $args = array();
  234. $args['offset'] = $request['offset'];
  235. $args['order'] = $request['order'];
  236. $args['orderby'] = $request['orderby'];
  237. $args['paged'] = $request['page'];
  238. $args['post__in'] = $request['include'];
  239. $args['post__not_in'] = $request['exclude'];
  240. $args['posts_per_page'] = $request['per_page'];
  241. $args['name'] = $request['slug'];
  242. $args['post_parent__in'] = $request['parent'];
  243. $args['post_parent__not_in'] = $request['parent_exclude'];
  244. $args['s'] = $request['search'];
  245. if ( 'date' === $args['orderby'] ) {
  246. $args['orderby'] = 'date ID';
  247. }
  248. $args['date_query'] = array();
  249. // Set before into date query. Date query must be specified as an array of an array.
  250. if ( isset( $request['before'] ) ) {
  251. $args['date_query'][0]['before'] = $request['before'];
  252. }
  253. // Set after into date query. Date query must be specified as an array of an array.
  254. if ( isset( $request['after'] ) ) {
  255. $args['date_query'][0]['after'] = $request['after'];
  256. }
  257. // Force the post_type argument, since it's not a user input variable.
  258. $args['post_type'] = $this->post_type;
  259. /**
  260. * Filter the query arguments for a request.
  261. *
  262. * Enables adding extra arguments or setting defaults for a post
  263. * collection request.
  264. *
  265. * @param array $args Key value array of query var to query value.
  266. * @param WP_REST_Request $request The request used.
  267. */
  268. $args = apply_filters( "woocommerce_rest_{$this->post_type}_object_query", $args, $request );
  269. return $this->prepare_items_query( $args, $request );
  270. }
  271. /**
  272. * Get objects.
  273. *
  274. * @since 3.0.0
  275. * @param array $query_args Query args.
  276. * @return array
  277. */
  278. protected function get_objects( $query_args ) {
  279. $query = new WP_Query();
  280. $result = $query->query( $query_args );
  281. $total_posts = $query->found_posts;
  282. if ( $total_posts < 1 ) {
  283. // Out-of-bounds, run the query again without LIMIT for total count.
  284. unset( $query_args['paged'] );
  285. $count_query = new WP_Query();
  286. $count_query->query( $query_args );
  287. $total_posts = $count_query->found_posts;
  288. }
  289. return array(
  290. 'objects' => array_map( array( $this, 'get_object' ), $result ),
  291. 'total' => (int) $total_posts,
  292. 'pages' => (int) ceil( $total_posts / (int) $query->query_vars['posts_per_page'] ),
  293. );
  294. }
  295. /**
  296. * Get a collection of posts.
  297. *
  298. * @param WP_REST_Request $request Full details about the request.
  299. * @return WP_Error|WP_REST_Response
  300. */
  301. public function get_items( $request ) {
  302. $query_args = $this->prepare_objects_query( $request );
  303. $query_results = $this->get_objects( $query_args );
  304. $objects = array();
  305. foreach ( $query_results['objects'] as $object ) {
  306. if ( ! wc_rest_check_post_permissions( $this->post_type, 'read', $object->get_id() ) ) {
  307. continue;
  308. }
  309. $data = $this->prepare_object_for_response( $object, $request );
  310. $objects[] = $this->prepare_response_for_collection( $data );
  311. }
  312. $page = (int) $query_args['paged'];
  313. $max_pages = $query_results['pages'];
  314. $response = rest_ensure_response( $objects );
  315. $response->header( 'X-WP-Total', $query_results['total'] );
  316. $response->header( 'X-WP-TotalPages', (int) $max_pages );
  317. $base = $this->rest_base;
  318. $attrib_prefix = '(?P<';
  319. if ( strpos( $base, $attrib_prefix ) !== false ) {
  320. $attrib_names = array();
  321. preg_match( '/\(\?P<[^>]+>.*\)/', $base, $attrib_names, PREG_OFFSET_CAPTURE );
  322. foreach ( $attrib_names as $attrib_name_match ) {
  323. $beginning_offset = strlen( $attrib_prefix );
  324. $attrib_name_end = strpos( $attrib_name_match[0], '>', $attrib_name_match[1] );
  325. $attrib_name = substr( $attrib_name_match[0], $beginning_offset, $attrib_name_end - $beginning_offset );
  326. if ( isset( $request[ $attrib_name ] ) ) {
  327. $base = str_replace( "(?P<$attrib_name>[\d]+)", $request[ $attrib_name ], $base );
  328. }
  329. }
  330. }
  331. $base = add_query_arg( $request->get_query_params(), rest_url( sprintf( '/%s/%s', $this->namespace, $base ) ) );
  332. if ( $page > 1 ) {
  333. $prev_page = $page - 1;
  334. if ( $prev_page > $max_pages ) {
  335. $prev_page = $max_pages;
  336. }
  337. $prev_link = add_query_arg( 'page', $prev_page, $base );
  338. $response->link_header( 'prev', $prev_link );
  339. }
  340. if ( $max_pages > $page ) {
  341. $next_page = $page + 1;
  342. $next_link = add_query_arg( 'page', $next_page, $base );
  343. $response->link_header( 'next', $next_link );
  344. }
  345. return $response;
  346. }
  347. /**
  348. * Delete a single item.
  349. *
  350. * @param WP_REST_Request $request Full details about the request.
  351. * @return WP_REST_Response|WP_Error
  352. */
  353. public function delete_item( $request ) {
  354. $force = (bool) $request['force'];
  355. $object = $this->get_object( (int) $request['id'] );
  356. $result = false;
  357. if ( ! $object || 0 === $object->get_id() ) {
  358. return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
  359. }
  360. $supports_trash = EMPTY_TRASH_DAYS > 0 && is_callable( array( $object, 'get_status' ) );
  361. /**
  362. * Filter whether an object is trashable.
  363. *
  364. * Return false to disable trash support for the object.
  365. *
  366. * @param boolean $supports_trash Whether the object type support trashing.
  367. * @param WC_Data $object The object being considered for trashing support.
  368. */
  369. $supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
  370. if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) {
  371. /* translators: %s: post type */
  372. return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) );
  373. }
  374. $request->set_param( 'context', 'edit' );
  375. $response = $this->prepare_object_for_response( $object, $request );
  376. // If we're forcing, then delete permanently.
  377. if ( $force ) {
  378. $object->delete( true );
  379. $result = 0 === $object->get_id();
  380. } else {
  381. // If we don't support trashing for this type, error out.
  382. if ( ! $supports_trash ) {
  383. /* translators: %s: post type */
  384. return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( 'status' => 501 ) );
  385. }
  386. // Otherwise, only trash if we haven't already.
  387. if ( is_callable( array( $object, 'get_status' ) ) ) {
  388. if ( 'trash' === $object->get_status() ) {
  389. /* translators: %s: post type */
  390. return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 410 ) );
  391. }
  392. $object->delete();
  393. $result = 'trash' === $object->get_status();
  394. }
  395. }
  396. if ( ! $result ) {
  397. /* translators: %s: post type */
  398. return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) );
  399. }
  400. /**
  401. * Fires after a single object is deleted or trashed via the REST API.
  402. *
  403. * @param WC_Data $object The deleted or trashed object.
  404. * @param WP_REST_Response $response The response data.
  405. * @param WP_REST_Request $request The request sent to the API.
  406. */
  407. do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request );
  408. return $response;
  409. }
  410. /**
  411. * Prepare links for the request.
  412. *
  413. * @param WC_Data $object Object data.
  414. * @param WP_REST_Request $request Request object.
  415. * @return array Links for the given post.
  416. */
  417. protected function prepare_links( $object, $request ) {
  418. $links = array(
  419. 'self' => array(
  420. 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $object->get_id() ) ),
  421. ),
  422. 'collection' => array(
  423. 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
  424. ),
  425. );
  426. return $links;
  427. }
  428. /**
  429. * Get the query params for collections of attachments.
  430. *
  431. * @return array
  432. */
  433. public function get_collection_params() {
  434. $params = array();
  435. $params['context'] = $this->get_context_param();
  436. $params['context']['default'] = 'view';
  437. $params['page'] = array(
  438. 'description' => __( 'Current page of the collection.', 'woocommerce' ),
  439. 'type' => 'integer',
  440. 'default' => 1,
  441. 'sanitize_callback' => 'absint',
  442. 'validate_callback' => 'rest_validate_request_arg',
  443. 'minimum' => 1,
  444. );
  445. $params['per_page'] = array(
  446. 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
  447. 'type' => 'integer',
  448. 'default' => 10,
  449. 'minimum' => 1,
  450. 'maximum' => 100,
  451. 'sanitize_callback' => 'absint',
  452. 'validate_callback' => 'rest_validate_request_arg',
  453. );
  454. $params['search'] = array(
  455. 'description' => __( 'Limit results to those matching a string.', 'woocommerce' ),
  456. 'type' => 'string',
  457. 'sanitize_callback' => 'sanitize_text_field',
  458. 'validate_callback' => 'rest_validate_request_arg',
  459. );
  460. $params['after'] = array(
  461. 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
  462. 'type' => 'string',
  463. 'format' => 'date-time',
  464. 'validate_callback' => 'rest_validate_request_arg',
  465. );
  466. $params['before'] = array(
  467. 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
  468. 'type' => 'string',
  469. 'format' => 'date-time',
  470. 'validate_callback' => 'rest_validate_request_arg',
  471. );
  472. $params['exclude'] = array(
  473. 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
  474. 'type' => 'array',
  475. 'items' => array(
  476. 'type' => 'integer',
  477. ),
  478. 'default' => array(),
  479. 'sanitize_callback' => 'wp_parse_id_list',
  480. );
  481. $params['include'] = array(
  482. 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
  483. 'type' => 'array',
  484. 'items' => array(
  485. 'type' => 'integer',
  486. ),
  487. 'default' => array(),
  488. 'sanitize_callback' => 'wp_parse_id_list',
  489. );
  490. $params['offset'] = array(
  491. 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
  492. 'type' => 'integer',
  493. 'sanitize_callback' => 'absint',
  494. 'validate_callback' => 'rest_validate_request_arg',
  495. );
  496. $params['order'] = array(
  497. 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
  498. 'type' => 'string',
  499. 'default' => 'desc',
  500. 'enum' => array( 'asc', 'desc' ),
  501. 'validate_callback' => 'rest_validate_request_arg',
  502. );
  503. $params['orderby'] = array(
  504. 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
  505. 'type' => 'string',
  506. 'default' => 'date',
  507. 'enum' => array(
  508. 'date',
  509. 'id',
  510. 'include',
  511. 'title',
  512. 'slug',
  513. ),
  514. 'validate_callback' => 'rest_validate_request_arg',
  515. );
  516. if ( $this->hierarchical ) {
  517. $params['parent'] = array(
  518. 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
  519. 'type' => 'array',
  520. 'items' => array(
  521. 'type' => 'integer',
  522. ),
  523. 'sanitize_callback' => 'wp_parse_id_list',
  524. 'default' => array(),
  525. );
  526. $params['parent_exclude'] = array(
  527. 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
  528. 'type' => 'array',
  529. 'items' => array(
  530. 'type' => 'integer',
  531. ),
  532. 'sanitize_callback' => 'wp_parse_id_list',
  533. 'default' => array(),
  534. );
  535. }
  536. return $params;
  537. }
  538. }