DemoUmamiRequirements.php

Namespace

Drupal\demo_umami\Hook

File

core/profiles/demo_umami/src/Hook/DemoUmamiRequirements.php

View source
<?php

declare (strict_types=1);
namespace Drupal\demo_umami\Hook;

use Drupal\Core\Extension\ProfileExtensionList;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Requirements for the Demo: Umami Food Magazine (Experimental) profile.
 */
class DemoUmamiRequirements {
    use StringTranslationTrait;
    public function __construct(ProfileExtensionList $profileExtensionList) {
    }
    
    /**
     * Implements hook_runtime_requirements().
     */
    public function runtime() : array {
        $requirements = [];
        $profile = \Drupal::installProfile();
        $info = $this->profileExtensionList
            ->getExtensionInfo($profile);
        $requirements['experimental_profile_used'] = [
            'title' => $this->t('Experimental installation profile used'),
            'value' => $info['name'],
            'description' => $this->t('Experimental profiles are provided for testing purposes only. Use at your own risk. To start building a new site, reinstall Drupal and choose a non-experimental profile.'),
            'severity' => REQUIREMENT_WARNING,
        ];
        return $requirements;
    }

}

Classes

Title Deprecated Summary
DemoUmamiRequirements Requirements for the Demo: Umami Food Magazine (Experimental) profile.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.