FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Date.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class Date extends \Rsi\Fred\Controller\View\Html\Widget{
6 
7  protected $_inputDisabled = 'readonly';
8 
9  protected function attribs(){
10  $length = strlen(preg_replace('/\\w/','??',str_replace('Y','????',$format = $this->_widget->local->dateFormat)));
11  $attribs = ['maxlength' => $length,'size' => $length];
12  if($words = $this->_view->component('trans')->str($this->_widget->placeholder)) try{
13  $words = \Rsi\Record::explode($words,';','=');
14  $placeholder = '';
15  foreach(str_split($format) as $char) $placeholder .= $words[$char] ?? $char;
16  $attribs['placeholder'] = $placeholder;
17  }
18  catch(\Exception $e){
19  $this->_view->component('log')->warning("Invalid placeholder '$words': " . $e->getMessage());
20  }
21  return array_merge(parent::attribs(),$attribs);
22  }
23 
24 }
Rsi\Fred\Controller\View\Html\Widget\Date\$_inputDisabled
$_inputDisabled
Definition: Date.php:7
Rsi\Fred\Controller\View\Html\Widget\Date\attribs
attribs()
Definition: Date.php:9
Rsi\Fred\Controller\View\Html\Widget
Definition: Char.php:3
Rsi\Fred\Controller\View\Html\Widget\Date
Definition: Date.php:5
Rsi\Fred\Exception
Definition: Exception.php:5