| @@ 124-137 (lines=14) @@ | ||
| 121 | if (is_array($this->owner->config()->get('allowed_elements'))) { |
|
| 122 | $list = $this->owner->config()->get('allowed_elements'); |
|
| 123 | ||
| 124 | if($this->owner->config()->get('sort_types_alphabetically') !== false) { |
|
| 125 | $sorted = array(); |
|
| 126 | ||
| 127 | foreach ($list as $class) { |
|
| 128 | $inst = singleton($class); |
|
| 129 | ||
| 130 | if ($inst->canCreate()) { |
|
| 131 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 132 | } |
|
| 133 | } |
|
| 134 | ||
| 135 | $list = $sorted; |
|
| 136 | asort($list); |
|
| 137 | } |
|
| 138 | } else { |
|
| 139 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 140 | $list = array(); |
|
| @@ 97-110 (lines=14) @@ | ||
| 94 | if (is_array($this->config()->get('allowed_elements'))) { |
|
| 95 | $list = $this->config()->get('allowed_elements'); |
|
| 96 | ||
| 97 | if($this->config()->get('sort_types_alphabetically') !== false) { |
|
| 98 | $sorted = array(); |
|
| 99 | ||
| 100 | foreach ($list as $class) { |
|
| 101 | $inst = singleton($class); |
|
| 102 | ||
| 103 | if ($inst->canCreate()) { |
|
| 104 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 105 | } |
|
| 106 | } |
|
| 107 | ||
| 108 | $list = $sorted; |
|
| 109 | asort($list); |
|
| 110 | } |
|
| 111 | } else { |
|
| 112 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 113 | $list = array(); |
|