entity_share_cron.install in Entity Share Cron 8
Same filename and directory in other branches
Install, update and uninstall functions for the Entity share cron module.
File
entity_share_cron.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Entity share cron module.
*/
use Drupal\entity_share_cron\EntityShareCronServiceInterface;
/**
* Implements hook_install().
*/
function entity_share_cron_install() {
// Initializes the queue.
$queue_name = EntityShareCronServiceInterface::PENDING_QUEUE_NAME;
\Drupal::queue($queue_name)
->createQueue();
}
/**
* Set enabled operations for channels.
*/
function entity_share_cron_update_8101() {
$config = \Drupal::configFactory()
->getEditable('entity_share_cron.settings');
// Enables both operations (create and update) for each channel.
$remotes = $config
->get('remotes');
foreach ($remotes as $remote_id => $remote_config) {
$channels = isset($remote_config['channels']) ? $remote_config['channels'] : [];
foreach ($channels as $channel_id => $channel_config) {
$remotes[$remote_id]['channels'][$channel_id]['operations'] = [
'create' => TRUE,
'update' => TRUE,
];
}
}
$config
->set('remotes', $remotes)
->save();
}
Functions
Name | Description |
---|---|
entity_share_cron_install | Implements hook_install(). |
entity_share_cron_update_8101 | Set enabled operations for channels. |