'dashicons-camera', 'category' => 'apis', 'preview_image' => Consts::get_url() . 'admin/img/blocks/unslplash.jpg', 'description' => __( "Find beautiful pictures from the best free photos stock", 'advanced-gutenberg-blocks' ), 'options_callback' => array( $this, 'settings' ), 'require' => __('This block requires an API key'), 'available' => false, ); Blocks::register_block( 'advanced-gutenberg-blocks/unsplash', __( 'Unsplash', 'advanced-gutenberg-blocks' ), $args ); // Register settings Blocks::register_setting( 'advanced-gutenberg-blocks-unsplash-api-key' ); } public function settings() { echo '

' . __( 'The API key is mandatory, you can create one on the OpenGraph.io API service. ' ) . '

'; } public function editor_assets() { $api_key = get_option( 'advanced-gutenberg-blocks-unsplash-api-key' ); $data = array(); if ( $api_key == "" ) { $data['error'] = 'noApiKey'; } else { $data['apiKey'] = $api_key; } wp_localize_script( Consts::BLOCKS_SCRIPT, 'advancedGutenbergBlocksUnsplash', $data ); } }