diff --git a/payment/uc_payment/uc_payment.admin.inc b/payment/uc_payment/uc_payment.admin.inc
index 7eb7835a..d27b966d 100644
--- a/payment/uc_payment/uc_payment.admin.inc
+++ b/payment/uc_payment/uc_payment.admin.inc
@@ -142,7 +142,7 @@ function uc_payment_by_order_form($form, &$form_state, $order) {
if ($payments !== FALSE) {
foreach ($payments as $payment) {
$form['payments'][$payment->receipt_id]['received'] = array(
- '#markup' => format_date($payment->received, 'custom', config_get('uc_store.settings', 'date_format_uc_store') . 'H:i:s'),
+ '#markup' => format_date($payment->received, 'custom', config_get('system.date', 'formats.uc_store.pattern') . 'H:i:s'),
);
$form['payments'][$payment->receipt_id]['user'] = array(
'#markup' => theme('uc_uid', array('uid' => $payment->uid)),
diff --git a/uc_reports/uc_reports.admin.inc b/uc_reports/uc_reports.admin.inc
index b9e06dfa..2ddc5a43 100644
--- a/uc_reports/uc_reports.admin.inc
+++ b/uc_reports/uc_reports.admin.inc
@@ -1290,7 +1290,7 @@ function uc_reports_sales_custom() {
// Create the date title for the subreport.
if ($args['length'] == 'day') {
- $date = format_date($subreport['start'], 'custom', config_get('uc_store.settings', 'date_format_uc_store') . ' - D');
+ $date = format_date($subreport['start'], 'custom', config_get('system.date', 'formats.uc_store.pattern') . ' - D');
}
else {
$date = format_date($subreport['start'], 'uc_store') . ' - ' . format_date($subreport['end'], 'uc_store');
diff --git a/uc_store/config/uc_store.settings.json b/uc_store/config/uc_store.settings.json
index 64261890..589773bd 100644
--- a/uc_store/config/uc_store.settings.json
+++ b/uc_store/config/uc_store.settings.json
@@ -1,6 +1,5 @@
{
"_config_name": "uc_store.settings",
- "date_format_uc_store": "m/d/Y",
"uc_store_country": 840,
"uc_store_owner": "",
"uc_store_email_include_name": true,
diff --git a/uc_store/uc_store.install b/uc_store/uc_store.install
index 4cca2dfd..7e19e5a7 100644
--- a/uc_store/uc_store.install
+++ b/uc_store/uc_store.install
@@ -156,6 +156,90 @@ function uc_store_install() {
_uc_store_add_footer_blocks();
}
+/**
+ * Implements hook_disable().
+ */
+function uc_store_disable() {
+ // Remove the footer block from all existing layouts.
+ _uc_store_remove_footer_blocks();
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function uc_store_uninstall() {
+ // Unset mail handler for all Ubercart modules.
+ $config = config('system.mail');
+ $config->clear('uc_cart');
+ $config->clear('uc_order');
+ $config->clear('uc_file');
+ $config->clear('uc_roles');
+ $config->clear('uc_stock');
+ $config->clear('uc_store');
+ $config->save();
+}
+
+/**
+ * Add the Ubercart footer block to the bottom of relevant layouts using the
+ * specified footer message.
+ */
+function _uc_store_add_footer_blocks($footer_message = 0) {
+ $layouts = layout_load_all();
+ foreach ($layouts as $name => $layout) {
+ // Only consider default layouts and any layout whose path is 'node/%'
+ // (which could be a product node).
+ if (!in_array($name, array('default', 'admin_default')) && $layout->getPath() != 'node/%') {
+ continue;
+ }
+
+ // Try to find the appropriate region for each layout. If there's no footer
+ // or bottom region, then skip this layout.
+ $regions = $layout->positions;
+ if (isset($regions['footer'])) {
+ $region = 'footer';
+ }
+ elseif (isset($regions['bottom'])) {
+ $region = 'bottom';
+ }
+ else {
+ continue;
+ }
+
+ // Check whether there's already a UcBlockFooter in this layout. If there
+ // is, then we won't add another one.
+ foreach ($layout->content as $block) {
+ if (get_class($block) == 'UcBlockFooter') {
+ continue 2;
+ }
+ }
+
+ // Add our block to the layout.
+ $block = $layout->addBlock('uc_store', 'uc_store_footer', $region);
+ $block->settings['uc_footer_message'] = $footer_message;
+
+ // Add our visibility condition to the block.
+ $handler = layout_create_handler('layout_access', 'uc_store_path');
+ $block->conditions[] = $handler;
+
+ $layout->save();
+ }
+}
+
+/**
+ * Remove the Ubercart footer block from all layouts.
+ */
+function _uc_store_remove_footer_blocks() {
+ $layouts = layout_load_all();
+ foreach ($layouts as $layout) {
+ foreach ($layout->content as $uuid => $block) {
+ if (get_class($block) == 'UcBlockFooter') {
+ $layout->removeBlock($uuid);
+ }
+ }
+ $layout->save();
+ }
+}
+
/**
* Implements hook_update_last_removed().
*/
@@ -317,85 +401,17 @@ function uc_store_update_1002() {
}
/**
- * Implements hook_disable().
- */
-function uc_store_disable() {
- // Remove the footer block from all existing layouts.
- _uc_store_remove_footer_blocks();
-}
-
-/**
- * Implements hook_uninstall().
- */
-function uc_store_uninstall() {
- // Unset mail handler for all Ubercart modules.
- $config = config('system.mail');
- $config->clear('uc_cart');
- $config->clear('uc_order');
- $config->clear('uc_file');
- $config->clear('uc_roles');
- $config->clear('uc_stock');
- $config->clear('uc_store');
- $config->save();
-}
-
-/**
- * Add the Ubercart footer block to the bottom of relevant layouts using the
- * specified footer message.
- */
-function _uc_store_add_footer_blocks($footer_message = 0) {
- $layouts = layout_load_all();
- foreach ($layouts as $name => $layout) {
- // Only consider default layouts and any layout whose path is 'node/%'
- // (which could be a product node).
- if (!in_array($name, array('default', 'admin_default')) && $layout->getPath() != 'node/%') {
- continue;
- }
-
- // Try to find the appropriate region for each layout. If there's no footer
- // or bottom region, then skip this layout.
- $regions = $layout->positions;
- if (isset($regions['footer'])) {
- $region = 'footer';
- }
- elseif (isset($regions['bottom'])) {
- $region = 'bottom';
- }
- else {
- continue;
- }
-
- // Check whether there's already a UcBlockFooter in this layout. If there
- // is, then we won't add another one.
- foreach ($layout->content as $block) {
- if (get_class($block) == 'UcBlockFooter') {
- continue 2;
- }
- }
-
- // Add our block to the layout.
- $block = $layout->addBlock('uc_store', 'uc_store_footer', $region);
- $block->settings['uc_footer_message'] = $footer_message;
-
- // Add our visibility condition to the block.
- $handler = layout_create_handler('layout_access', 'uc_store_path');
- $block->conditions[] = $handler;
-
- $layout->save();
- }
-}
-
-/**
- * Remove the Ubercart footer block from all layouts.
+ * Store date format in date system config.
*/
-function _uc_store_remove_footer_blocks() {
- $layouts = layout_load_all();
- foreach ($layouts as $layout) {
- foreach ($layout->content as $uuid => $block) {
- if (get_class($block) == 'UcBlockFooter') {
- $layout->removeBlock($uuid);
- }
- }
- $layout->save();
- }
+function uc_store_update_1003() {
+ $date_format = config_get('uc_store.settings', 'date_format_uc_store');
+ // @todo delete date_format_uc_store when its easier to make a breaking
+ // change.
+ $date_config = config('system.date');
+ $date_config->set('formats.' . 'uc_store', array(
+ 'label' => 'Ubercart Store',
+ 'pattern' => $date_format,
+ 'module' => 'uc_store',
+ ));
+ $date_config->save();
}