marketo_ma-8.x-2.x-dev/modules/marketo_ma_contact/marketo_ma_contact.module
modules/marketo_ma_contact/marketo_ma_contact.module
<?php
/**
* @file
* Contains marketo_ma_contact.module.
*/
use Drupal\contact\ContactFormInterface;
use Drupal\contact\MessageInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
* Implements hook_help().
*/
function marketo_ma_contact_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the marketo_ma_contact module.
case 'help.page.marketo_ma_contact':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Integrates Marketo MA with Contact module forms.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_entity_operation().
*/
function marketo_ma_contact_entity_operation(EntityInterface $entity) {
$operations = [];
if ($entity instanceof ContactFormInterface) {
$operations['marketo_ma_contact_mapping'] = [
'title' => t('Marketo configuration'),
'url' => Url::fromRoute('marketo_ma_contact.contact.configuration', ['contact_form' => $entity->id()]),
'weight' => 50,
];
}
return $operations;
}
/**
* Implements hook_contact_message_insert().
*/
function marketo_ma_contact_contact_message_insert(MessageInterface $message) {
\Drupal::service('marketo_ma_contact.hooks')->contactMessageInsert($message);
}
