| @@ 90-103 (lines=14) @@ | ||
| 87 | if (is_array($this->config()->get('allowed_elements'))) { |
|
| 88 | $list = $this->config()->get('allowed_elements'); |
|
| 89 | ||
| 90 | if($this->config()->get('sort_types_alphabetically') !== false) { |
|
| 91 | $sorted = array(); |
|
| 92 | ||
| 93 | foreach ($list as $class) { |
|
| 94 | $inst = singleton($class); |
|
| 95 | ||
| 96 | if ($inst->canCreate()) { |
|
| 97 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | $list = $sorted; |
|
| 102 | asort($list); |
|
| 103 | } |
|
| 104 | } else { |
|
| 105 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 106 | $list = array(); |
|
| @@ 120-133 (lines=14) @@ | ||
| 117 | if (is_array($this->owner->config()->get('allowed_elements'))) { |
|
| 118 | $list = $this->owner->config()->get('allowed_elements'); |
|
| 119 | ||
| 120 | if($this->owner->config()->get('sort_types_alphabetically') !== false) { |
|
| 121 | $sorted = array(); |
|
| 122 | ||
| 123 | foreach ($list as $class) { |
|
| 124 | $inst = singleton($class); |
|
| 125 | ||
| 126 | if ($inst->canCreate()) { |
|
| 127 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| 131 | $list = $sorted; |
|
| 132 | asort($list); |
|
| 133 | } |
|
| 134 | } else { |
|
| 135 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 136 | $list = array(); |
|