You are here

function _mobile_detect_get_readme in Mobile Detect 8.2

Helper for mobile_detect readme.

1 call to _mobile_detect_get_readme()
mobile_detect_help in ./mobile_detect.module
Implements hook_help().

File

./mobile_detect.module, line 32
Contains mobile_detect.module.

Code

function _mobile_detect_get_readme() {
  $readme = file_get_contents(dirname(__FILE__) . '/README.txt');

  // Get the module handler service.
  $module_handler = \Drupal::moduleHandler();
  if ($module_handler
    ->moduleExists('markdown')) {
    $filters = $module_handler
      ->invoke('markdown', 'filter_info');
    $info = $filters['filter_markdown'];
    if (function_exists($info['process callback'])) {
      $function = $info['process callback'];
      $output = Xss::filterAdmin($function($readme, NULL));
    }
    else {
      $output = '<pre>' . Html::escape($readme) . '</pre>';
    }
  }
  else {
    $output = '<pre>' . Html::escape($readme) . '</pre>';
  }
  return $output;
}