fetchNewStoreMessages(); } /** * Implements hook_requirements(). */ function commerce_requirements($phase) { $requirements = []; if ($phase == 'install' || $phase == 'runtime') { if (!extension_loaded('bcmath')) { $requirements['commerce_bcmath'] = [ 'title' => t('BC Math'), 'description' => t('Commerce requires the BC Math PHP extension.'), 'severity' => REQUIREMENT_ERROR, ]; } } return $requirements; } /** * Implements hook_schema(). */ function commerce_schema() { return [ 'commerce_inbox_message' => [ 'description' => 'Stores the Commerce inbox messages.', 'fields' => [ 'id' => [ 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'ID of the message', ], 'subject' => [ 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'Subject of the message', ], 'message' => [ 'type' => 'text', 'not null' => TRUE, 'size' => 'big', 'description' => 'Text of the message.', ], 'cta_text' => [ 'type' => 'text', 'not null' => TRUE, 'size' => 'small', 'description' => 'CTA text', ], 'cta_link' => [ 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'CTA link', ], 'send_date' => [ 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'Send date.', ], 'state' => [ 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'unread', 'description' => 'State', ], ], 'primary key' => ['id'], 'indexes' => [ 'state' => ['state'], ], ], ]; } /** * Install the Token module. */ function commerce_update_8201() { \Drupal::service('module_installer')->install(['token']); } /** * Install the `commerce_inbox_message` table schema. */ function commerce_update_8202() { $schema = \Drupal::database()->schema(); // Create database table. if (!$schema->tableExists('commerce_inbox_message')) { $tables = commerce_schema(); $schema->createTable('commerce_inbox_message', $tables['commerce_inbox_message']); } } /** * Create a Commerce inbox message announcing the new dashboard. */ function commerce_update_8203() { $inbox_message = new InboxMessage( 'commerce.8203', 'Introducing the Commerce Dashboard', "Commerce Core 2.37 introduced a new dashboard to Drupal Commerce. Designed with merchants in mind, it includes easy access management links, sales metrics and summary reports, and project updates in the form of a \"Commerce inbox.\" Future releases will build on this work to give you even greater insight into your store's performance.", '', '', \Drupal::time()->getRequestTime(), 'unread' ); \Drupal::service('commerce.inbox_message_storage')->save($inbox_message); }