auctions-1.0.x-dev/modules/auctions_core/auctions_core.install
modules/auctions_core/auctions_core.install
<?php
/**
* @file
*/
use Drupal\user\Entity\Role;
/**
* @file
* Contains auctions_core.module.
*/
/**
* Implements hook_install() for the Auctions Core module.
*
* Enables required modules and performs other tasks when module is installed.
*/
function auctions_core_install() {
// Enable Auction Mail toolkit (soft dependency)
\Drupal::service('module_installer')->install(['auctions_mail']);
}
/**
* Implements hook_uninstall() for the Auctions Core module.
*
* Disable required modules and remove configuration when module is uninstalled.
*/
function auctions_core_uninstall() {
// Disable Auction Mail toolkit (soft dependency)
\Drupal::service('module_installer')->uninstall(['auctions_mail']);
// Remove the general configuration used by this module.
\Drupal::configFactory()->getEditable('auctions.item_settings')->delete();
\Drupal::configFactory()->getEditable('editor.editor.auction_html')->delete();
\Drupal::configFactory()->getEditable('filter.format.auction_html')->delete();
}
/**
* Implements hook_update_X() 90120 for the Auctions Core module.
*
* Add permission for ALL to see Bids In Progress.
*/
function auctions_core_update_90120() {
$role_object = Role::load('anonymous');
$role_object->grantPermission('see auction bid inprogress');
$role_object->save();
$role_object = Role::load('authenticated');
$role_object->grantPermission('see auction bid inprogress');
$role_object->save();
}
/**
* Implements hook_update_X() 90200 for the Auctions Core module.
*
* add in initial 'long' date format countdown format.
*/
function auctions_core_update_90200() {
\Drupal::configFactory()->getEditable('auctions.item_settings')
->set('use_format', 'long')
->save(TRUE);
}
/**
* Implements hook_update_X() 90203 for the Bid Refresh (which will be hidden at this release).
*
* add in initial 'long' date format countdown format.
*/
function auctions_core_update_90203() {
\Drupal::configFactory()->getEditable('auctions.item_settings')
->set('ajax-refresh', 1)
->set('ajax-preactivate', 0)
->set('ajax-rate', 10)
->set('refresh-adrenaline', 60)
->save(TRUE);
}
