Skip to content

Commit 4826e6d

Browse files
author
Thomas Hunziker
committed
Don't process value adjusting twice
1 parent 97b664a commit 4826e6d

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

libraries/joomla/form/fields/calendar.php

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -185,44 +185,8 @@ public function setup(SimpleXMLElement $element, $value, $group = null)
185185
*/
186186
protected function getInput()
187187
{
188-
return $this->getRenderer($this->layout)->render($this->getLayoutData());
189-
}
190-
191-
/**
192-
* Method to get the data to be passed to the layout for rendering.
193-
*
194-
* @return array
195-
*
196-
* @since __DEPLOY_VERSION__
197-
*/
198-
protected function getLayoutData()
199-
{
200-
$data = parent::getLayoutData();
201-
$tag = JFactory::getLanguage()->getTag();
202-
$calendar = JFactory::getLanguage()->getCalendar();
203188
$config = JFactory::getConfig();
204189
$user = JFactory::getUser();
205-
$direction = strtolower(JFactory::getDocument()->getDirection());
206-
207-
// Get the appropriate file for the current language date helper
208-
$helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';
209-
210-
if (!empty($calendar) && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar)))
211-
{
212-
$helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
213-
}
214-
215-
// Get the appropriate locale file for the current language
216-
$localesPath = 'system/fields/calendar-locales/en.js';
217-
218-
if (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js'))
219-
{
220-
$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
221-
}
222-
elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
223-
{
224-
$localesPath = 'system/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
225-
}
226190

227191
// Translate the format if requested
228192
$translateFormat = (string) $this->element['translateformat'];
@@ -287,6 +251,43 @@ protected function getLayoutData()
287251
$this->value = '';
288252
}
289253

254+
return $this->getRenderer($this->layout)->render($this->getLayoutData());
255+
}
256+
257+
/**
258+
* Method to get the data to be passed to the layout for rendering.
259+
*
260+
* @return array
261+
*
262+
* @since __DEPLOY_VERSION__
263+
*/
264+
protected function getLayoutData()
265+
{
266+
$data = parent::getLayoutData();
267+
$tag = JFactory::getLanguage()->getTag();
268+
$calendar = JFactory::getLanguage()->getCalendar();
269+
$direction = strtolower(JFactory::getDocument()->getDirection());
270+
271+
// Get the appropriate file for the current language date helper
272+
$helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';
273+
274+
if (!empty($calendar) && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar)))
275+
{
276+
$helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
277+
}
278+
279+
// Get the appropriate locale file for the current language
280+
$localesPath = 'system/fields/calendar-locales/en.js';
281+
282+
if (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js'))
283+
{
284+
$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
285+
}
286+
elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
287+
{
288+
$localesPath = 'system/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
289+
}
290+
290291
$extraData = array(
291292
'value' => $this->value,
292293
'maxLength' => $this->maxlength,

0 commit comments

Comments
 (0)