Skip to content

Commit

Permalink
Replace YYYY in the copyright line by the current year
Browse files Browse the repository at this point in the history
Follow up for magento#5004
  • Loading branch information
amenk committed Jan 19, 2023
1 parent 1c874bd commit 790381b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/code/Magento/Theme/Block/Html/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getCopyright()
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
return __($this->_copyright);
return $this->replaceCurrentYear(__($this->_copyright));
}

/**
Expand Down Expand Up @@ -133,4 +133,12 @@ protected function getCacheLifetime()
{
return parent::getCacheLifetime() ?: 3600;
}

/**
* Replace YYYY by the current year
*/
private function replaceCurrentYear($text)
{
return str_replace('YYYY', (new \DateTime())->format('Y'), $text)
}
}

0 comments on commit 790381b

Please sign in to comment.