Your code is given below.
/**
* Implements hook_menu().
* Add the clear_cache menu link text, and link it to the clear_cache_truncate() function
*/
function clear_cache_menu() {
$items = array();
$items['admin/clearcache'] = array(
'title' => 'Clear Cache',
'page callback' => 'clear_cache_truncate',
'access arguments' => array('use clear cache'),
'type' => MENU_NORMAL_ITEM,
'weight' => 16,
);
return $items;
}
module_load_include('inc', 'clear_cache', 'clear_cache.clear');
Module should not use module_load_include directly in module file, better to use file or file path.
"file": A file that will be included before the page callback is called; this allows page callback functions to be in separate files. The file should be relative to the implementing module's directory unless otherwise specified by the "file path" option. Does not apply to other callbacks (only page callback).
"file path": The path to the directory containing the file specified in "file". This defaults to the path to the module implementing the hook.
reference: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
drupal_set_message(t('Success ✌ <br/>All Drupal Caches cleared.'), 'status');
t() translate the string, in this case
tag will also translated.
Issue fork clear_cache-2987743
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rajveergangwarComment #3
geforcegtx480 commented@rajveergang, my apologies for the delay, been a while since I updated this module and reviewed issues, been busy with a cyber security project.
Do you have a patch for the two issues:
1. Hook_menu should use include file
2. and html tags in drupal_set_message
If you do, I can roll that in on the next release/version.
Thank you.
Comment #4
avpadernoActually, HTML tags in translatable strings should be avoided; they must not be removed from translatable strings. Between giving more context to translators and avoiding to include HTML markup in translatable strings, it is better to give more context to translators, which means that text should be split just to avoid to include HTML markup.