From b6e203dfe70084e3bd8f0e1aafe5189f613a44da Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 27 Oct 2019 12:56:24 +0100 Subject: [PATCH] [Notifier] Add the possibility to add actions on Slack messages --- .../Bridge/Slack/Block/SlackActionsBlock.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackActionsBlock.php diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackActionsBlock.php b/src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackActionsBlock.php new file mode 100644 index 0000000000000..85b63d2109d71 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackActionsBlock.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\Slack\Block; + +/** + * @author Fabien Potencier + */ +final class SlackActionsBlock extends AbstractSlackBlock +{ + public function __construct() + { + $this->options['type'] = 'actions'; + } + + /** + * @return $this + */ + public function button(string $text, string $url, string $style = null): self + { + $element = [ + 'type' => 'button', + 'text' => [ + 'type' => 'plain_text', + 'text' => $text, + ], + 'url' => $url, + ]; + + if ($style) { + // primary or danger + $element['style'] = $style; + } + + $this->options['elements'][] = $element; + + return $this; + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy