search_api_attachments_commerce_product_reference.module in Search API attachments 7
Drupal hooks.
File
contrib/search_api_attachments_commerce_product_reference/search_api_attachments_commerce_product_reference.moduleView source
<?php
/**
* @file
* Drupal hooks.
*/
/**
* Implements hook_help().
*/
function search_api_attachments_commerce_product_reference_help($path, $arg) {
switch ($path) {
case 'admin/help#search_api_attachments_commerce_product_reference':
$filepath = dirname(__FILE__) . '/README.md';
if (file_exists($filepath)) {
$readme = file_get_contents($filepath);
}
else {
$filepath = dirname(__FILE__) . '/README.txt';
if (file_exists($filepath)) {
$readme = file_get_contents($filepath);
}
}
if (!isset($readme)) {
return NULL;
}
if (module_exists('markdown')) {
$filters = module_invoke('markdown', 'filter_info');
$info = $filters['filter_markdown'];
if (function_exists($info['process callback'])) {
$output = $info['process callback']($readme, NULL);
}
else {
$output = '<pre>' . $readme . '</pre>';
}
}
else {
$output = '<pre>' . $readme . '</pre>';
}
return $output;
}
}
/**
* Implements hook_search_api_alter_callback_info().
*/
function search_api_attachments_commerce_product_reference_search_api_alter_callback_info() {
$callbacks['search_api_attachments_commerce_product_reference_alter_settings'] = array(
'name' => t('File attachments Commerce product reference'),
'description' => t('Extract the content of attached files of a referenced Commerce product and index it.'),
'class' => 'SearchApiAttachmentsCommerceProductReferenceAlterSettings',
);
return $callbacks;
}