1 <?php
 2 
 3 /**
 4  * @package redaxo\core
 5  */
 6 class rex_clang_perm extends rex_complex_perm
 7 {
 8     public function hasPerm($clang)
 9     {
10         return $this->hasAll() || in_array($clang, $this->perms);
11     }
12 
13     public function count()
14     {
15         return $this->hasAll() ? rex_clang::count() : count($this->perms);
16     }
17 
18     public function getClangs()
19     {
20         return $this->hasAll() ? rex_clang::getAllIds() : $this->perms;
21     }
22 
23     public static function getFieldParams()
24     {
25         $options = array_map(function (rex_clang $clang) {
26             return $clang->getName();
27         }, rex_clang::getAll());
28 
29         return [
30             'label' => rex_i18n::msg('clangs'),
31             'all_label' => rex_i18n::msg('all_clangs'),
32             'options' => $options,
33         ];
34     }
35 }
36