public function getAlert($context, $key = null)
    {
        $session = $this->container->sessionHandler;

        // Get alert notices from page context, or failing that then session flash data
        $alert = (isset($context['alert'])) ? $context['alert'] : $session->getFlashData('alert');

        if ($key === null) {
            return $alert;
        }

        if (isset($alert[$key])) {
            if ($key === 'message' ) {
                return '<ul><li>' . implode('</li><li>', $alert['message']) . '</ul>';
            }

            return $alert[$key];
        }

        return null;
    }
public function getAlert($context, $key = null)
    {
        $session = $this->container->sessionHandler;

        // Get alert notices from page context, or failing that then session flash data
        $alert = (isset($context['alert'])) ? $context['alert'] : $session->getFlashData('alert');

        if ($key === null) {
            return $alert;
        }

        if (isset($alert[$key])) {
            if ($key === 'message' ) {
                return '<ul><li>' . implode('</li><li>', $alert['message']) . '</ul>';
            }

            return $alert[$key];
        }

        return null;
    }
public function getAlert ( $ context , $ key = null ) { $ session = $ this -> container -> sessionHandler ; // Get alert notices from page context, or failing that then session flash data $ alert = ( isset ( $ context [ 'alert' ] ) ) ? $ context [ 'alert' ] : $ session -> getFlashData ( 'alert' ) ; if ( $ key === null ) { return $ alert ; } if ( isset ( $ alert [ $ key ] ) ) { if ( $ key === 'message' ) { return '<ul><li>' . implode ( '</li><li>' , $ alert [ 'message' ] ) . '</ul>' ; } return $ alert [ $ key ] ; } return null ; }
Get Alert Messages

Get alert data. Returns null if no alert found.
@param  array  $context Twig context, includes controller alert array
@param  string $key     Alert keys: severity|heading|message
@return mixed           array|string|null
Get Alert Messages