aero_weather-1.0.3/aero_weather.module
aero_weather.module
<?php
/**
* @file
* Primary module file for the Aero Weather module.
*/
/**
* Implements hook_theme().
*
* Defines a new theme hook for the exchange rate block.
*/
function aero_weather_theme() {
return [
'aero_weather_horizontal_block' => [
'variables' => [
'weather_data' => [],
'config' => [],
],
],
'aero_weather_vertical_block' => [
'variables' => [
'weather_data' => [],
'config' => [],
],
],
];
}
/**
* Returns a list of predefined color palette options.
*
* These palettes can be used to style the weather widget with different themes.
* The array keys represent the internal palette identifiers, and the values are
* arrays containing a human-readable label.
*
* @return array
* An associative array of color palette options, suitable for use in
* a select element or theming logic.
*/
function aero_weather_color_palettes(): array {
$palettes = [
'' => t('None'),
'palette-1' => t('Blue Ocean'),
'palette-2' => t('Sunset'),
'palette-3' => t('Forest'),
'palette-4' => t('Purple Dream'),
'palette-5' => t('Orange Glow'),
'palette-6' => t('Calm Sea'),
'palette-7' => t('Pink Paradise'),
'palette-8' => t('Emerald'),
'palette-9' => t('Golden Hour'),
'palette-10' => t('Deep Sea'),
'palette-11' => t('Lavender'),
'palette-12' => t('Coral Reef'),
'palette-13' => t('Aqua Sky'),
'palette-14' => t('Rose Gold'),
'palette-15' => t('Ocean Breeze'),
'palette-16' => t('Peach Sunset'),
'palette-17' => t('Twilight'),
'palette-18' => t('Minty Fresh'),
'palette-19' => t('Light Sky'),
'palette-20' => t('Dark Shadow'),
'palette-21' => t('Lemonade'),
'palette-22' => t('Frostbite'),
'palette-23' => t('Ruby Red'),
'palette-24' => t('Electric Blue'),
'palette-25' => t('Champagne Blush'),
'palette-26' => t('Tropical Storm'),
'palette-27' => t('Sunrise Peach'),
'palette-28' => t('White'),
'palette-29' => t('Vibrant Sunset'),
'palette-30' => t('Galaxy Purple'),
];
// Allow other modules to alter the palette list.
\Drupal::moduleHandler()->alter('aero_weather_color_palettes', $palettes);
return $palettes;
}
/**
* Generates a unique identifier for a weather card.
*
* This function generates a unique UUID for a weather card. The UUID is
* prefixed with 'weather-card-' to provide a meaningful context and avoid
* potential conflicts with other types of UUIDs.
*
* @return string
* A unique UUID string prefixed with 'weather-card-'.
*/
function aero_weather_generate_weather_card_uuid() {
// Generate a UUID with 'weather-card-' prefix.
$uuid = 'weather-card-' . \Drupal::service('uuid')->generate();
return $uuid;
}
