Merge branch 'catalog'
Conflicts: core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php
This commit is contained in:
@@ -29,6 +29,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -90,15 +91,15 @@ class Feed extends BaseLoop
|
||||
$author = $item->get_author();
|
||||
$description = $item->get_description();
|
||||
|
||||
$date = $item->get_date('d/m/Y');
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, null, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("URL", $item->get_permalink());
|
||||
$loopResultRow->set("TITLE", $item->get_title());
|
||||
$loopResultRow->set("AUTHOR", $item->get_author());
|
||||
$loopResultRow->set("DESCRIPTION", $item->get_description());
|
||||
$loopResultRow->set("DATE", $item->get_date('d/m/Y')); // FIXME - date format should be an intl parameter
|
||||
$loopResultRow
|
||||
->set("URL" , $item->get_permalink())
|
||||
->set("TITLE" , $item->get_title())
|
||||
->set("AUTHOR" , $item->get_author())
|
||||
->set("DESCRIPTION" , $item->get_description())
|
||||
->set("DATE" , $item->get_date('U')) // FIXME - date format should be an intl parameter
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,17 @@ class Format extends AbstractSmartyPlugin
|
||||
$date = $this->getParam($params, "date", false);
|
||||
|
||||
if ($date === false) {
|
||||
return "";
|
||||
|
||||
// Check if we have a timestamp
|
||||
$timestamp = $this->getParam($params, "timestamp", false);
|
||||
|
||||
if ($timestamp === false) {
|
||||
// No timestamp => error
|
||||
throw new SmartyPluginException("Either date or timestamp is a mandatory parameter in format_date function");
|
||||
} else {
|
||||
$date = new \DateTime();
|
||||
$date->setTimestamp($timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!($date instanceof \DateTime)) {
|
||||
@@ -87,7 +97,6 @@ class Format extends AbstractSmartyPlugin
|
||||
}
|
||||
|
||||
return $date->format($format);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user