Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement issue #4 - support translated and custom date formats.
- Loading branch information
1 parent
c3058db
commit 457fb54
Showing
7 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/system/modules/metamodelsattribute_timestamp/dca/tl_metamodel_rendersetting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* The MetaModels extension allows the creation of multiple collections of custom items, | ||
* each with its own unique set of selectable attributes, with attribute extendability. | ||
* The Front-End modules allow you to build powerful listing and filtering of the | ||
* data in each collection. | ||
* | ||
* PHP version 5 | ||
* @package MetaModels | ||
* @subpackage AttributeTimestamp | ||
* @author Christian Schiffler <c.schiffler@cyberspectrum.de> | ||
* @copyright The MetaModels team. | ||
* @license LGPL. | ||
* @filesource | ||
*/ | ||
|
||
/** | ||
* Table tl_metamodel_attribute | ||
*/ | ||
$GLOBALS['TL_DCA']['tl_metamodel_rendersetting']['metapalettes']['timestamp extends default'] = array | ||
( | ||
'timesettings' => array('timeformat') | ||
); | ||
|
||
$GLOBALS['TL_DCA']['tl_metamodel_rendersetting']['fields']['timeformat'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_rendersetting']['timeformat'], | ||
'exclude' => true, | ||
'inputType' => 'text', | ||
'eval' => array | ||
( | ||
'tl_class' => 'w50' | ||
) | ||
); |
26 changes: 26 additions & 0 deletions
26
src/system/modules/metamodelsattribute_timestamp/languages/en/tl_metamodel_rendersetting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* The MetaModels extension allows the creation of multiple collections of custom items, | ||
* each with its own unique set of selectable attributes, with attribute extendability. | ||
* The Front-End modules allow you to build powerful listing and filtering of the | ||
* data in each collection. | ||
* | ||
* PHP version 5 | ||
* @package MetaModels | ||
* @subpackage AttributeTimestamp | ||
* @author Christian Schiffler <c.schiffler@cyberspectrum.de> | ||
* @copyright The MetaModels team. | ||
* @license LGPL. | ||
* @filesource | ||
*/ | ||
|
||
/** | ||
* Fields | ||
*/ | ||
$GLOBALS['TL_LANG']['tl_metamodel_rendersetting']['timeformat'] = array('Format', 'Here you can define a custom date format. If empty, the default will be used. The format string will be parsed with the PHP date() function.'); | ||
|
||
/** | ||
* Legends | ||
*/ | ||
$GLOBALS['TL_LANG']['tl_metamodel_rendersetting']['timesettings_legend'] = 'Date and time settings'; |
6 changes: 1 addition & 5 deletions
6
src/system/modules/metamodelsattribute_timestamp/templates/mm_attr_timestamp.html5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
<?php if($this->attribute->get('timetype') == 'date'):?> | ||
<span class="text"><?php if ($this->raw !== null): ?><?php echo date($GLOBALS['TL_CONFIG']['dateFormat'], $this->raw); ?><?php endif; ?></span> | ||
<?php elseif($this->attribute->get('timetype') == 'datim'): ?> | ||
<span class="text"><?php if ($this->raw !== null): ?><?php echo date($GLOBALS['TL_CONFIG']['datimFormat'], $this->raw); ?><?php endif; ?></span> | ||
<?php endif; ?> | ||
<span class="text"><?php echo $this->parsedDate; ?></span> |
8 changes: 1 addition & 7 deletions
8
src/system/modules/metamodelsattribute_timestamp/templates/mm_attr_timestamp.text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
<?php if ($this->raw !== null): ?> | ||
<?php if($this->attribute->get('timetype') == 'date'):?> | ||
<?php echo date($GLOBALS['TL_CONFIG']['dateFormat'], $this->raw); ?> | ||
<?php elseif($this->attribute->get('timetype') == 'datim'): ?> | ||
<?php echo date($GLOBALS['TL_CONFIG']['datimFormat'], $this->raw); ?> | ||
<?php endif; ?> | ||
<?php endif; ?> | ||
<?php echo $this->parsedDate; ?> |
6 changes: 1 addition & 5 deletions
6
src/system/modules/metamodelsattribute_timestamp/templates/mm_attr_timestamp.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
<?php if($this->attribute->get('timetype') == 'date'):?> | ||
<span class="text"><?php if ($this->raw !== null): ?><?php echo date($GLOBALS['TL_CONFIG']['dateFormat'], $this->raw); ?><?php endif; ?></span> | ||
<?php elseif($this->attribute->get('timetype') == 'datim'): ?> | ||
<span class="text"><?php if ($this->raw !== null): ?><?php echo date($GLOBALS['TL_CONFIG']['datimFormat'], $this->raw); ?><?php endif; ?></span> | ||
<?php endif; ?> | ||
<span class="text"><?php echo $this->parsedDate; ?></span> |