marketo_ma-8.x-2.x-dev/marketo_ma.module
marketo_ma.module
<?php
/**
* @file
* Contains marketo_ma.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
/**
* Implements hook_help().
*/
function marketo_ma_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the marketo_ma module.
case 'help.page.marketo_ma':
return t('<h3>:about</h3><p>:description</p>', [
':about' => 'About',
':description' => 'Integration with Marketo marketing automation software.',
]);
default:
}
}
/**
* Implements hook_page_attachments().
*
* Adds the marketo_ma javascript to all pages.
*/
function marketo_ma_page_attachments(array &$page) {
// Hand off to the attachment service.
try {
\Drupal::service('marketo_ma.page_attachment')->pageAttachments($page);
}
catch (ServiceNotFoundException $e) {
// During upgrade this service might not exist so fail quietly.
\Drupal::logger('marketo_ma')->warning('Page attachment service is missing.');
}
}
