Hooks
The actions and filters of Elio Blocks. Generated from the code of Elio Blocks 1.0.0.
elio_blocks_init
Action, with add_action().
Fires once the built-in provider and the "elio" icon collection are registered.
Register custom providers and condition icon collections here: the registries are locked right after (init, priority 26). A registration made anywhere else, like any invalid one, is refused with a _doing_it_wrong() notice and false, as register_block_type() does.
A provider holds what it serves, one adapter per domain: a WeatherForecastAdapterInterface for the weather forecast.
add_action( 'elio_blocks_init', function() {
elio_blocks_register_provider( new \ElioBlocks\Provider\Provider(
'my-provider',
'My Provider',
array(
new \ElioBlocks\Provider\ProviderCredential( 'api_key', __( 'API Key', 'my-plugin' ), required: true, secret: true ),
),
new \ElioBlocks\Provider\ProviderAttribution( 'https://my-provider.example/' ),
array( new MyWeatherForecastAdapter() ),
) );
elio_blocks_register_condition_icon_collection( 'my-theme', array(
'label' => __( 'My Theme', 'my-theme' ),
'description' => __( 'Weather icons drawn for My Theme.', 'my-theme' ),
) );
elio_blocks_register_condition_icon( 'my-theme/sun', array(
'file_path' => get_theme_file_path( 'icons/sun.svg' ), // or 'content' => '<svg…>'
'label' => __( 'Sun', 'my-theme' ),
'style' => 'stroke', // 'fill' by default
'conditions' => array( array( 'clear-sky', 'day' ), array( 'mainly-clear', 'day' ) ),
) );
} );
Since 0.1.0
elio_blocks/condition_descriptions
Filter, with add_filter().
Filters the descriptions of the weather conditions: the text the condition description block prints, and the label of the condition icons.
Parameters
$descriptionsarray<string, string>: Translated description of each condition, by condition slug ('clear-sky','overcast'…).
Since 0.1.0
elio_blocks/weather_forecast_public_access
Filter, with add_filter().
Filters whether the weather forecast endpoint accepts unsigned anonymous requests.
Enable it only for headless setups, behind your own rate limiting.
Parameters
$isPublicbool: Default false.
Since 0.1.0