(Retrofit from trunk) N°1006.2 Templates: $this->raw(attcode)$ can be used to display an date(time) attribute in the SQL format like before.

SVN:2.4[4919]
This commit is contained in:
Guillaume Lajarige
2017-09-18 15:56:08 +00:00
parent 0938ba939c
commit b3ad2030cb

View File

@@ -702,7 +702,7 @@ abstract class AttributeDefinition
break;
default:
throw new Exception("Unknown verb '$sVerb' for attribute ".$this->GetCode().' in class '.get_class($oHostObj));
throw new Exception("Unknown verb '$sVerb' for attribute ".$this->GetCode().' in class '.get_class($oHostObject));
}
}
return null;
@@ -3963,12 +3963,40 @@ class AttributeDateTime extends AttributeDBField
return $oFormField;
}
/**
* @inheritdoc
*/
public function EnumTemplateVerbs()
{
return array(
'' => 'Formatted representation',
'raw' => 'Not formatted representation',
);
}
/**
* @inheritdoc
*/
public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true)
{
return static::GetFormat()->format($value);
switch ($sVerb)
{
case '':
case 'text':
return static::GetFormat()->format($value);
break;
case 'html':
// Note: Not passing formatted value as the method will format it.
return $this->GetAsHTML($value);
break;
case 'raw':
return $value;
break;
default:
return parent::GetForTemplate($value, $sVerb, $oHostObject, $bLocalize);
break;
}
return null;
}
static public function ListExpectedParams()