Skip to content

Commit

Permalink
Merge branch 'release/1.0.10' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Mar 9, 2019
2 parents c966063 + 5f38a65 commit 0dea7ea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Recipe Changelog

## 1.0.10 - 2019.03.08
### Changed
* Fixed the Asset Sources settings to work with Craft 3.1

## 1.0.9 - 2019.03.08
### Changed
* Add 1/3 and 1/6 fractions
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-recipe",
"description": "A comprehensive recipe FieldType for Craft CMS that includes metric/imperial conversion, portion calculation, and JSON-LD microdata support",
"type": "craft-plugin",
"version": "1.0.9",
"version": "1.0.10",
"keywords": [
"craft",
"cms",
Expand Down
22 changes: 21 additions & 1 deletion src/fields/Recipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use craft\base\ElementInterface;
use craft\base\Field;
use craft\elements\Asset;
use craft\helpers\Html;
use craft\helpers\Json;

use yii\db\Schema;
Expand Down Expand Up @@ -100,7 +101,7 @@ public function getSettingsHtml()
.'Recipe_settings',
[
'field' => $this,
'assetSources' => Asset::sources(),
'assetSources' => $this->getSourceOptions(),
]
);
}
Expand Down Expand Up @@ -159,4 +160,23 @@ public function getInputHtml($value, ElementInterface $element = null): string
]
);
}

/**
* @inheritdoc
*/
public function getSourceOptions(): array
{
$sourceOptions = [];

foreach (Asset::sources('settings') as $key => $volume) {
if (!isset($volume['heading'])) {
$sourceOptions[] = [
'label' => Html::encode($volume['label']),
'value' => $volume['key']
];
}
}

return $sourceOptions;
}
}

0 comments on commit 0dea7ea

Please sign in to comment.