client_connection_square-8.x-1.0-alpha4/client_connection_square.module
client_connection_square.module
<?php
/**
* @file
* Contains client_connection_square.module.
*/
use Drupal\client_connection_square\Plugin\ClientConnection\Square;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function client_connection_square_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the client_connection_square module.
case 'help.page.client_connection_square':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('A Client Connection implementation of the Square api.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_cron().
*/
function client_connection_square_cron() {
$plugin = \Drupal::service('plugin.manager.client_connection')->loadConfigPlugin('square');
if ($plugin instanceof Square) {
$plugin->updateAccessToken();
}
else {
\Drupal::logger('client_connection_square')->debug('No client connection setup, skipping');
}
}
