Added lcp-ui.js and changes to blocks

This commit is contained in:
Jeremy Rangel
2024-12-30 17:39:30 -08:00
parent b9e2660318
commit 4b78f9f571
18 changed files with 55007 additions and 107450 deletions

View File

@ -35,7 +35,7 @@ function register_icons_rest_api_endpoint() {
register_rest_route( 'lcp/v1', '/icons', array(
'methods' => 'GET',
'callback' => 'get_icons_data_from_db',
'permission_callback' => '__return_true', // Public access; modify this if needed
'permission_callback' => '__return_true', // Public access; modify this if real permissions needed
) );
}
@ -46,7 +46,7 @@ function get_icons_data_from_db() {
// Query the lcp_icons table
$results = $wpdb->get_results(
"SELECT id, name, paths, viewbox FROM {$wpdb->prefix}lcp_icons"
"SELECT icon_id, icon_name, paths, viewbox FROM {$wpdb->prefix}lcp_icons"
);
// If no icons are found, return an empty array
@ -57,10 +57,10 @@ function get_icons_data_from_db() {
// Format the results for the frontend
$icons = array_map( function( $icon ) {
return [
'iconSvgId' => $icon->id, // Icon ID
'iconSvgId' => $icon->icon_id, // Icon ID
'iconSvgPaths' => $icon->paths, // SVG paths (can be multiple)
'selectedIconViewbox' => $icon->viewbox, // ViewBox for the SVG
'name' => $icon->name, // Add name field
'name' => $icon->icon_name, // Add name field
];
}, $results );