Skip to content

Commit

Permalink
Fix for "Error: Cannot mutate DI container after it has been initiali…
Browse files Browse the repository at this point in the history
…sed"

Unable to include only when the field is in use as the DI has already been initialised

Checked how the JS and CSS is included for `asset-admin` and noticed that its
  included with LeftAndMain so doing the same thing for this and problem is
  no more :)
  • Loading branch information
oilee80 committed Mar 23, 2018
1 parent 3195c01 commit 42f8190
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 7 additions & 0 deletions _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ After:
- '#assetadmingraphql-dependencies'
- '#assetadminthumbnails'
- '#assetsfieldtypes'
- '#assetadmin'
---

SilverStripe\Core\Injector\Injector:
Expand All @@ -23,3 +24,9 @@ SilverStripe\Core\Injector\Injector:

DBFile:
class: MadeHQ\Cloudinary\Storage\DBFile

SilverStripe\Admin\LeftAndMain:
extra_requirements_javascript:
- mademedia/silverstripe-cloudinary:client/dist/js/bundle.js
extra_requirements_css:
- mademedia/silverstripe-cloudinary:client/dist/styles/bundle.css
2 changes: 0 additions & 2 deletions src/Forms/UploadFileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public function __construct($name, $title = null, $value = null)
TextareaField::create(sprintf('%s[Description]', $name), 'Description'),
];

Requirements::javascript('resources/mademedia/silverstripe-cloudinary/client/dist/js/bundle.js');
Requirements::css('resources/mademedia/silverstripe-cloudinary/client/dist/styles/bundle.css');
parent::__construct($name, $title, $value);
$this->setTemplate('UploadFileField');
}
Expand Down

0 comments on commit 42f8190

Please sign in to comment.