You are here

function opigno_calendar_generate_entry in Opigno calendar 8

Same name and namespace in other branches
  1. 3.x opigno_calendar.module \opigno_calendar_generate_entry()

Build day date box.

1 call to opigno_calendar_generate_entry()
opigno_calendar_preprocess_calendar_month_col in ./opigno_calendar.module
Implements hook_preprocess_HOOK().

File

./opigno_calendar.module, line 83
Contains opigno_calendar.module.

Code

function opigno_calendar_generate_entry($variables, $content, $attached) {
  $date = new DateTimePlus($variables['item']['date']);
  return [
    '#attached' => $attached,
    'date_box' => [
      '#theme_wrappers' => [
        'container',
      ],
      '#attributes' => [
        'class' => [
          'date-box',
        ],
      ],
      'content' => [
        'day' => [
          '#type' => 'html_tag',
          '#tag' => 'span',
          '#attributes' => [
            'class' => [
              'date-day',
            ],
          ],
          '#value' => $date
            ->format('d'),
        ],
        'month' => [
          '#type' => 'html_tag',
          '#tag' => 'span',
          '#attributes' => [
            'class' => [
              'date-month',
            ],
          ],
          '#value' => t($date
            ->format('F')),
        ],
        'year' => [
          '#type' => 'html_tag',
          '#tag' => 'span',
          '#attributes' => [
            'class' => [
              'date-year',
            ],
          ],
          '#value' => $date
            ->format('Y'),
        ],
      ],
    ],
    'day_label' => [
      '#type' => 'html_tag',
      '#tag' => 'h4',
      '#attributes' => [
        'class' => [
          'title',
        ],
      ],
      '#value' => t('Events of the day'),
    ],
    'items' => [
      '#theme_wrappers' => [
        'container',
      ],
      '#attributes' => [
        'class' => [
          'items',
        ],
      ],
      'content' => $content,
    ],
  ];
}