| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function getPluginOptions($options = []) |
||
| 22 | { |
||
| 23 | return parent::getPluginOptions(ArrayHelper::merge([ |
||
| 24 | 'select2Options' => [ |
||
| 25 | 'tags' => true, |
||
| 26 | 'tokenSeparators' => [', ', ' '], |
||
| 27 | 'createTag' => new JsExpression(/** @lang JavaScript */' |
||
| 28 | function (query) { |
||
| 29 | var term = query.term; |
||
| 30 | |||
| 31 | if (term.match(/^[0-9a-zA-Z\._+-]+@([0-9a-z][0-9a-z_-]*\.)+[0-9a-z][0-9a-z-]*$/i)) { |
||
| 32 | return { |
||
| 33 | id: term, |
||
| 34 | text: term, |
||
| 35 | tag: true |
||
| 36 | }; |
||
| 37 | } |
||
| 38 | |||
| 39 | return null; |
||
| 40 | } |
||
| 41 | '), |
||
| 42 | ], |
||
| 43 | ], $options)); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |