| @@ 104-117 (lines=14) @@ | ||
| 101 | if (is_array($this->config()->get('allowed_elements'))) { |
|
| 102 | $list = $this->config()->get('allowed_elements'); |
|
| 103 | ||
| 104 | if($this->config()->get('sort_types_alphabetically') !== false) { |
|
| 105 | $sorted = array(); |
|
| 106 | ||
| 107 | foreach ($list as $class) { |
|
| 108 | $inst = singleton($class); |
|
| 109 | ||
| 110 | if ($inst->canCreate()) { |
|
| 111 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| 115 | $list = $sorted; |
|
| 116 | asort($list); |
|
| 117 | } |
|
| 118 | } else { |
|
| 119 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 120 | $list = array(); |
|
| @@ 132-145 (lines=14) @@ | ||
| 129 | if (is_array($this->owner->config()->get('allowed_elements'))) { |
|
| 130 | $list = $this->owner->config()->get('allowed_elements'); |
|
| 131 | ||
| 132 | if($this->owner->config()->get('sort_types_alphabetically') !== false) { |
|
| 133 | $sorted = array(); |
|
| 134 | ||
| 135 | foreach ($list as $class) { |
|
| 136 | $inst = singleton($class); |
|
| 137 | ||
| 138 | if ($inst->canCreate()) { |
|
| 139 | $sorted[$class] = singleton($class)->i18n_singular_name(); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| 143 | $list = $sorted; |
|
| 144 | asort($list); |
|
| 145 | } |
|
| 146 | } else { |
|
| 147 | $classes = ClassInfo::subclassesFor('BaseElement'); |
|
| 148 | $list = array(); |
|