Skip to content
This repository was archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
fix(MediaHolder): Fixed bug where array_merge would break the keys of…
Browse files Browse the repository at this point in the history
… MediaType. (#6)

The array_merge would turn:
Array
(
    [5] => 2 Column
    [1] => Blog
    [2] => Event
    [3] => News
    [4] => Publication
)

into:

Array
(
    [0] =>
    [1] => 2 Column
    [2] => Blog
    [3] => Event
    [4] => News
    [5] => Publication
)

Meaning that the set MediaType would be incorrect.
  • Loading branch information
silbinarywolf authored and Nathan Glasl committed Dec 22, 2016
1 parent 3125099 commit dc226f0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions code/pages/MediaHolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public function getCMSFields() {
$fields->addFieldToTab('Root.Main', DropdownField::create(
'MediaTypeID',
'Media Type',
array_merge(array(
0 => ''
), MediaType::get()->map()->toArray())
), 'Title');
MediaType::get()->map()->toArray()
)->setHasEmptyDefault(true), 'Title');

// Allow customisation of the media URL format.

Expand Down

0 comments on commit dc226f0

Please sign in to comment.