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