For Developers

Last updated on
3 October 2026

Each section of a Sentinel assessment comes from a provider plugin. Add your own to show more information about a location, such as air quality, river gauges, school closures or road conditions.

Providers

Sentinel ships with these providers, run lightest first:

ID Weight Adds
place -10 City, county and state ($assessment->place)
flood_zone 0 FEMA flood zone ($assessment->floodZone)
alerts 10 Active alerts ($assessment->alerts)
disasters 15 FEMA disaster declarations
earthquakes 16 Earthquakes nearby
advice 20 What to do about the alerts

Site builders can turn any provider off in Sentinel's settings.

Writing a provider

namespace Drupal\mymodule\Plugin\SentinelProvider;

use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\sentinel\Assessment;
use Drupal\sentinel\Attribute\SentinelProvider;
use Drupal\sentinel\SentinelProviderInterface;

#[SentinelProvider(
  id: 'air_quality',
  label: new TranslatableMarkup('Air quality'),
  weight: 12,
)]
class AirQualityProvider extends PluginBase implements SentinelProviderInterface {

  public function assess(Assessment $assessment): void {
    // Look up data for $assessment->point (latitude, longitude). Earlier
    // providers have set $assessment->place, ->floodZone and ->alerts.
    // Add a note if a service is down:
    // $assessment->notes[] = 'Air quality could not be checked.';
  }

  public function build(Assessment $assessment): array {
    return ['#markup' => '<h3>Air quality</h3>...'];
  }

}

Use ContainerFactoryPluginInterface for services. Cache lookups by $assessment->point->rounded()->key() so nearby visitors share them. Return [] from build() to show nothing.

Services

Service Use
sentinel.assessment_builder assess($point, $label) and build($point, $label) for your own pages
sentinel.alert_store active(), forPoint($point, $countyFips), load($identifier)
sentinel.geo_client geocode(), place(), floodZone(), earthquakes(), disasters()
sentinel.safety_advice forAlerts() and asText()
sentinel.subscription_manager Sign people up from your own forms: subscribe(), subscribeAccount()

Services can also be autowired by class.

Templates

  • sentinel-assessment.html.twig: the banner, place, sections, notes and disclaimer.
  • sentinel-alerts.html.twig: the alert list.
  • sentinel-advice.html.twig: what to do.

Alert text is plain text from the official source and is escaped by Twig. Keep it unchanged when theming.

Cache tag

sentinel_alerts is invalidated whenever stored alerts change. Add it to anything you build from alerts.

Help improve this page

Page status: No known problems

You can: