Added lcp-ui.js and changes to blocks
This commit is contained in:
@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user