Skip to content

Commit

Permalink
Merge pull request #116 from newfold-labs/add/PRESS0-1924-Usage-Tags-UI
Browse files Browse the repository at this point in the history
PRESS-1924 Usage Tags UI
  • Loading branch information
zlateska authored Oct 18, 2024
2 parents d5e37c1 + 3757582 commit 7df0ae8
Show file tree
Hide file tree
Showing 26 changed files with 19,297 additions and 93 deletions.
2,051 changes: 2,046 additions & 5 deletions assets/build/utilities.css

Large diffs are not rendered by default.

141 changes: 140 additions & 1 deletion assets/build/utilities.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions assets/build/utilities.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,385 changes: 1,384 additions & 1 deletion build/2.5.0/wonder-blocks-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/2.5.0/wonder-blocks.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'a3c31cf86970f26876fd');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '7cb599dd8c72d124aa20');
1,387 changes: 1,386 additions & 1 deletion build/2.5.0/wonder-blocks.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/2.5.0/wonder-blocks.css.map

Large diffs are not rendered by default.

14,024 changes: 14,017 additions & 7 deletions build/2.5.0/wonder-blocks.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/2.5.0/wonder-blocks.js.map

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions includes/Api/Controllers/PatternUsageTagsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
namespace NewfoldLabs\WP\Module\Patterns\Api\Controllers;

use NewfoldLabs\WP\Module\Patterns\Library\UsageTags;
use NewfoldLabs\WP\Module\Patterns\Api\RemoteRequest;

/**
* Controller for templates.
*/
class PatternUsageTagsController {

/**
* Return all pattern categories.
*/
public static function index() {

$data = UsageTags::get();

if ( \is_wp_error( $data ) ) {
return new \WP_REST_Response( RemoteRequest::format_error_data( $data ), 503 );
}

return new \WP_REST_Response( $data );
}
}
2 changes: 2 additions & 0 deletions includes/Api/RestApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use NewfoldLabs\WP\Module\Patterns\Api\Controllers\FavoritesController;
use NewfoldLabs\WP\Module\Patterns\Api\Controllers\EventsController;
use NewfoldLabs\WP\Module\Patterns\Api\Controllers\CacheController;
use NewfoldLabs\WP\Module\Patterns\Api\Controllers\PatternUsageTagsController;
use NewfoldLabs\WP\Module\Patterns\Api\Controllers\PluginsController;

/**
Expand All @@ -30,6 +31,7 @@ public function __construct() {
public function register_routes() {
RestApiController::get( '/patterns', array( PatternsController::class, 'index' ) );
RestApiController::get( '/categories', array( PatternCategoriesController::class, 'index' ) );
RestApiController::get( '/usage_tags', array( PatternUsageTagsController::class, 'index' ) );

RestApiController::get( '/templates', array( TemplatesController::class, 'index' ) );
RestApiController::get( '/templateCategories', array( TemplateCategoriesController::class, 'index' ) );
Expand Down
2 changes: 1 addition & 1 deletion includes/Library/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Categories {
* @param string $orderby Attribute of the category to sort by. Default is 'order'.
* @param string $order Specifies the order of sorting. Acceptable values are 'ASC' for ascending order or 'DESC' for descending order. Default is 'ASC'.
*
* @return array
* @return array|WP_Error Array of categories or WP_Error if there was an error fetching the data.
*/
public static function get( $type = 'patterns', $orderby = 'order', $order = 'ASC' ) {

Expand Down
Loading

0 comments on commit 7df0ae8

Please sign in to comment.