Back to CalendarField class

Method getLayoutData

protected array
getLayoutData
()
Method to get the data to be passed to the layout for rendering.
Returns
  • array
Since
  • 3.7.0
Class: CalendarField
Project: Joomla

Method getLayoutData - Source code

/**
 * Method to get the data to be passed to the layout for rendering.
 *
 * @return  array
 *
 * @since  3.7.0
 */
protected function getLayoutData()
{
    $data = parent::getLayoutData();
    $lang = Factory::getApplication()->getLanguage();
    $calendar = $lang->getCalendar();
    $direction = strtolower(Factory::getDocument()->getDirection());
    // Get the appropriate file for the current language date helper
    $helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';
    if ($calendar && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar))) {
        $helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
    }
    $extraData = array('value' => $this->value, 'maxLength' => $this->maxlength, 'format' => $this->format, 'filter' => $this->filter, 'todaybutton' => $this->todaybutton === 'true' ? 1 : 0, 'weeknumbers' => $this->weeknumbers === 'true' ? 1 : 0, 'showtime' => $this->showtime === 'true' ? 1 : 0, 'filltable' => $this->filltable === 'true' ? 1 : 0, 'timeformat' => $this->timeformat, 'singleheader' => $this->singleheader === 'true' ? 1 : 0, 'helperPath' => $helperPath, 'minYear' => $this->minyear, 'maxYear' => $this->maxyear, 'direction' => $direction, 'calendar' => $calendar, 'firstday' => $lang->getFirstDay(), 'weekend' => explode(',', $lang->getWeekEnd()));
    return array_merge($data, $extraData);
}