Source of file FormMessageBootstrapAdapter.php
Size: 0,816 Bytes - Last Modified: 2021-12-23T10:27:20+00:00
/var/www/docs.ssmods.com/process/src/code/Forms/FormMessageBootstrapAdapter.php
123456789101112131415161718192021222324252627282930313233343536373839 | <?php namespace SilverStripe\Forms; use SilverStripe\Core\Extension; /** * Will convert a SilverStripe message type into a Bootstrap alert type */ class FormMessageBootstrapExtension extends Extension { /** * @var string[] */ protected $bootstrapAlertsMap = [ 'good' => 'alert-success', 'bad' => 'alert-danger', 'required' => 'alert-danger', 'warning' => 'alert-warning', ]; /** * Maps a SilverStripe message type to a Bootstrap alert type * * {@inheritdoc} */ public function getAlertType() { $type = $this->owner->getMessageType(); if (isset($this->bootstrapAlertsMap[$type])) { return $this->bootstrapAlertsMap[$type]; } // Fallback to original return $type; } } |