You are here

function responsive_favicons_requirements in Responsive Favicons 7

Same name and namespace in other branches
  1. 8 responsive_favicons.install \responsive_favicons_requirements()

Implements hook_requirements().

File

./responsive_favicons.install, line 11
Responsive favicons install file.

Code

function responsive_favicons_requirements($phase) {
  $requirements = array();
  if ($phase === 'runtime') {

    // Make sure that the favicons exist.
    $tags = responsive_favicons_load_all_icons();
    if (!empty($tags['missing'])) {
      $requirements['responsive_favicons_missing'] = array(
        'title' => t('Responsive favicons'),
        'value' => implode('<br/>', array_map('check_plain', $tags['missing'])),
        'description' => t('The favicon files are missing for the tags above. Go to <a href="@config-url">configuration page</a> to add missing files.', array(
          '@config-url' => url('admin/config/user-interface/responsive_favicons'),
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    if (!empty($tags['found'])) {
      $requirements['responsive_favicons_found'] = array(
        'title' => t('Responsive favicons'),
        'value' => format_plural(count($tags['found']), 'Found 1 favicon', 'Found @count favicons'),
        'severity' => REQUIREMENT_OK,
      );
    }

    // Point out the potential conflict with the favicon module.
    if (module_exists('favicon')) {
      $requirements['responsive_favicons_favicon_module'] = array(
        'title' => t('Responsive favicons'),
        'value' => t('You do not need to have the favicon module enabled when you have the responsive favicons module enabled. Please see the README for more information.'),
        'severity' => REQUIREMENT_WARNING,
      );
    }
  }
  return $requirements;
}