Skip to content

Commit

Permalink
Use assetSources service for asset field model
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Olde Hampsink committed Dec 16, 2015
1 parent c7669c0 commit aad36c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/models/AssetsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function getDefinition(FieldModel $field, $includeContext)
$settings = $definition['settings'];

$defaultUploadLocationSourceId = $settings['defaultUploadLocationSource'];
$defaultUploadLocationSource = Craft::app()->schematic_assets->getSourceTypeById($defaultUploadLocationSourceId);
$defaultUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($defaultUploadLocationSourceId);
$settings['defaultUploadLocationSource'] = $defaultUploadLocationSource ? $defaultUploadLocationSource->handle : '';

$singleUploadLocationSourceId = $settings['singleUploadLocationSource'];
$singleUploadLocationSource = Craft::app()->schematic_assets->getSourceTypeById($singleUploadLocationSourceId);
$singleUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($singleUploadLocationSourceId);
$settings['singleUploadLocationSource'] = $singleUploadLocationSource ? $singleUploadLocationSource->handle : '';

$definition['settings'] = $settings;
Expand All @@ -55,11 +55,11 @@ public function populate(array $fieldDefinition, FieldModel $field, $fieldHandle

$settings = $fieldDefinition['settings'];
$defaultUploadLocationSourceId = $settings['defaultUploadLocationSource'];
$defaultUploadLocationSource = Craft::app()->schematic_assets->getSourceTypeByHandle($defaultUploadLocationSourceId);
$defaultUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeByHandle($defaultUploadLocationSourceId);
$settings['defaultUploadLocationSource'] = $defaultUploadLocationSource ? $defaultUploadLocationSource->id : '';

$singleUploadLocationSourceId = $settings['singleUploadLocationSource'];
$singleUploadLocationSource = Craft::app()->schematic_assets->getSourceTypeByHandle($singleUploadLocationSourceId);
$singleUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeByHandle($singleUploadLocationSourceId);
$settings['singleUploadLocationSource'] = $singleUploadLocationSource ? $singleUploadLocationSource->id : '';

$field->settings = $settings;
Expand Down

0 comments on commit aad36c9

Please sign in to comment.