You are here

function phpwkhtmltopdf_failed_generic in PHP WK HTML to PDF 7.2

Creates the info to be returned during hook_requirements().

Parameters

string $lib_name The library machine name:

null $lib The library details from libraries_detect().:

Return value

array The results to be returned to hook_requirements.

1 string reference to 'phpwkhtmltopdf_failed_generic'
phpwkhtmltopdf_requirements in ./phpwkhtmltopdf.install
Implements hook_requirements().

File

./phpwkhtmltopdf.install, line 68

Code

function phpwkhtmltopdf_failed_generic($lib_name, $lib = NULL) {
  $t = get_t();
  module_load_include('module', 'phpwkhtmltopdf');

  // Get our defined details about the libraries to construct a helpful message.
  $libraries = phpwkhtmltopdf_libraries_info();

  // Default message is for a missing library.
  $problem = 'Missing';
  $message = $t('The !name library was not found. Please download and install the library into your sites libraries folder from: !download-url', array(
    '!name' => $libraries[$lib_name]['name'],
    '!download-url' => $libraries[$lib_name]['download url'],
  ));

  // Overwrite libraries default message for a missing library with our own.
  if (!$lib || isset($lib['error']) && $lib['error'] === 'not found') {

    // Reset the $lib with an array to hold our custom values.
    $lib = array();
    $lib['error'] = $problem;
    $lib['error message'] = $message;
  }
  return array(
    $lib_name => array(
      'title' => $libraries[$lib_name]['name'],
      'value' => $lib['error'],
      'severity' => REQUIREMENT_ERROR,
      'description' => $lib['error message'],
    ),
  );
}