Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0076ed5

Browse files
committed
feature#36154 [Notifier][Slack] Add fields on Slack Section block (birkof)
This PR was merged into the 5.1-dev branch.Discussion----------[Notifier][Slack] Add fields on Slack Section block| Q | A| ------------- | ---| Branch? | master <!-- see below -->| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets | <!-- prefix each issue number with "Fix #", if any -->| License | MIT| Doc PR | <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix. This will help peopleunderstand your PR and can be used as a start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (seehttps://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch master.-->Added `fields` field on section block.> An array of text objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10. Maximum length for the text in each item is 2000 characters.Example of use:```$slackOptions = (new SlackOptions()) ->block((new SlackSectionBlock())->text('My message')) ->block(new SlackDividerBlock()) ->block( (new SlackSectionBlock()) ->field('*Max Rating*') ->field('5.0') ->field('*Min Rating*') ->field('1.0') );```Expected output:<img width="677" alt="Screen Shot 2020-03-21 at 09 57 36" src="https://user-images.githubusercontent.com/65848/77222314-b8360c80-6b5a-11ea-874c-2cfb1829f839.png">Commits-------faad197 Added fields on Slack Section block
2 parents0c22ab8 +faad197 commit0076ed5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎src/Symfony/Component/Notifier/Bridge/Slack/Block/SlackSectionBlock.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ public function text(string $text, bool $markdown = true): self
3434
return$this;
3535
}
3636

37+
/**
38+
* @return $this
39+
*/
40+
publicfunctionfield(string$text,bool$markdown =true):self
41+
{
42+
$this->options['fields'][] = [
43+
'type' =>$markdown ?'mrkdwn' :'plain_text',
44+
'text' =>$text,
45+
];
46+
47+
return$this;
48+
}
49+
3750
/**
3851
* @return $this
3952
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp