← All changes
|
includes/template-library/data/endpoints/templates.php
+1
-22
4.1.0-dev2
→
3.6.7
View file →
| @@ -47,31 +47,11 @@ | ||
| 47 | 47 | return 'template-library/templates'; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function get_items( $request ) { |
| 51 | - return $this->reorder_categories( Plugin::$instance->templates_manager->get_library_data( [ 'filter_sources' => [ $request->get_param( 'source' ) ] ] ) ); | |
| 51 | + return Plugin::$instance->templates_manager->get_library_data( [ 'filter_sources' => [ $request->get_param( 'source' ) ] ] ); | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** | |
| 55 | - * Move the '404 page' category to the end of the list | |
| 56 | - * | |
| 57 | - * @param array $library_data | |
| 58 | - * @return array | |
| 59 | - */ | |
| 60 | - private function reorder_categories( array $library_data ): array { | |
| 61 | - $not_found_category = '404 page'; | |
| 62 | - | |
| 63 | - $key = array_search( $not_found_category, $library_data['config']['block']['categories'] ); | |
| 64 | - if ( false === $key ) { | |
| 65 | - return $library_data; | |
| 66 | - } | |
| 67 | - | |
| 68 | - array_splice( $library_data['config']['block']['categories'], $key, 1 ); | |
| 69 | - $library_data['config']['block']['categories'][] = $not_found_category; | |
| 70 | - | |
| 71 | - return $library_data; | |
| 72 | - } | |
| 73 | - | |
| 74 | 54 | public function create_items( $request ) { |
| 75 | 55 | /** @var Source_Local $source */ |
| 76 | 56 | $source = Plugin::$instance->templates_manager->get_source( 'local' ); |
| 77 | 57 | |
| @@ -78,9 +58,8 @@ | ||
| 78 | 58 | $result = $source->save_item( [ |
| 79 | 59 | 'title' => $request->get_param( 'title' ), |
| 80 | 60 | 'type' => $request->get_param( 'type' ), |
| 81 | 61 | 'content' => $request->get_param( 'content' ), |
| 82 | - 'page_settings' => $request->get_param( 'page_settings' ), | |
| 83 | 62 | ] ); |
| 84 | 63 | |
| 85 | 64 | if ( is_wp_error( $result ) ) { |
| 86 | 65 | return $result; |