instagram_importer-8.x-1.1/instagram_importer.module
instagram_importer.module
<?php
use Drupal\instagram_importer\instagramImport;
/**
* Implements hook_cron()
*/
function instagram_importer_cron() {
$instaSettings = \Drupal::config('instagram_importer.settings')->get('settings');
if($instaSettings['enabled'] === 1) {
$instagram = new instagramImport();
$instagram->prepare();
}
}
/**
* Implements hook_uninstall()
* Delete all nodes of type 'instagram' on uninstall
*/
function instagram_importer_uninstall() {
$nodes = \Drupal::entityTypeManager()
->getStorage('node')
->loadByProperties(array('type' => 'instagram'));
foreach ($nodes as $node) {
$node->delete();
}
Drupal::messenger()->addMessage(count($nodes). ' nodes of type Instagram deleted');
}
