示例#1
0
 /**
  * renderPassword
  *
  * @test
  */
 public function renderPassword()
 {
     $htmlGenerated = tx_t3devapi_html::renderPassword('test', 'test', array('class' => 'test'));
     $html = '<input type="password" name="test" id="test" value="test" class="test" />';
     $this->debug($htmlGenerated);
     $this->assertEquals(trim($htmlGenerated), $html);
 }
 /**
  * Generate a field from a tca type "input"
  *
  * @param string       $field
  * @param string|array $val
  * @return string
  */
 public function getFieldFromTcaInput($field, $val)
 {
     $config = $this->getFieldConfig($field);
     $attributes = array();
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->readOnlyFields, $field)) {
         $attributes['readonly'] = 'readonly';
     }
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['eval'], 'required')) {
         $attributes['required'] = 'required';
     }
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['eval'], 'password')) {
         // always display a blank password in edit mode
         if ($this->uid > 0) {
             $val = '';
             unset($attributes['required']);
         }
         return tx_t3devapi_html::renderPassword($this->getPrefix($field), $val, $attributes);
     }
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['eval'], 'datetime')) {
         $id = tx_t3devapi_html::cleanId($this->getPrefix($field));
         $this->addJs .= "\$('#" . $id . "').mobiscroll().datetime({lang:'" . $GLOBALS['TSFE']->lang . "',display:'bubble',mode:'clickpick'});\r\n";
     }
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['eval'], 'date')) {
         $id = tx_t3devapi_html::cleanId($this->getPrefix($field));
         $this->addJs .= "\$('#" . $id . "').mobiscroll().date({lang:'" . $GLOBALS['TSFE']->lang . "',display:'bubble',mode:'clickpick'});\r\n";
     }
     if (!empty($config['readOnly'])) {
         $attributes['readonly'] = 'readonly';
     }
     if (!empty($config)) {
         return tx_t3devapi_html::renderText($this->getPrefix($field), $val, $attributes);
     }
     $attributes['readonly'] = 'readonly';
     // default
     return tx_t3devapi_html::renderText($this->getPrefix($field), $val, $attributes);
 }