You are here

function template_preprocess_uikit_countdown in UIkit Components 8.3

Prepares variables for UIkit Countdown templates.

Default template: uikit-countdown.html.twig.

Parameters

$variables: An associative array containing:

  • element: An associative array containing:

    • #expire_date: The date when the countdown should expire using the ISO 8601 format, e.g. 2017-12-04T22:00:00+00:00 (UTC time).
    • #separators: An associative array to insert a separator between each number, containing:

      • days_hours: The separator to insert between the days and hours.
      • hours_minutes: The separator to insert between hours and minutes.
      • minutes_seconds: The separator to insert between minutes and seconds.
    • #labels: An associative array for labels to display below each number, containing:

      • days: The label to display for days.
      • hours: The label to display for hours.
      • minutes: The label to display for minutes.
      • seconds: The label to display for seconds.

See also

\Drupal\uikit_components\Element\UIkitCountdown

https://getuikit.com/docs/countdown

Related topics

File

includes/preprocess.inc, line 378
Set up variables to be placed within the template (.html.twig) files.

Code

function template_preprocess_uikit_countdown(&$variables) {
  $element = $variables['element'];

  // Set the separators and labels.
  $variables['separators'] = $element['#separators'];
  $variables['labels'] = $element['#labels'];

  // Set the attributes for the countdown.
  $variables['attributes'] = $element['#attributes'];
}