Completed
Push — master ( b27204...a2c64d )
by Nate
05:15 queued 02:48
created

SetUserTableAttributeHtml::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\organizations\events\handlers;
10
11
use craft\events\SetElementTableAttributeHtmlEvent;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 1.0.0
16
 */
17
class SetUserTableAttributeHtml
18
{
19
    /**
20
     * @param SetElementTableAttributeHtmlEvent $event
21
     * @throws \Twig_Error_Loader
22
     * @throws \yii\base\Exception
23
     */
24
    public static function handle(SetElementTableAttributeHtmlEvent $event)
25
    {
26
        if ($event->attribute === 'organizations') {
27
            $event->html = \Craft::$app->getView()->renderTemplate(
28
                'organizations/_components/tableAttributes/organizations',
29
                [
30
                    'organizations' => $event->sender->getOrganizations(['status' => null])->all()
31
                ]
32
            );
33
        }
34
    }
35
}
36