Skip to content

Commit

Permalink
### Added
Browse files Browse the repository at this point in the history
* Added an example of accessing a plugin's settings from a service
  • Loading branch information
Andrew Welch committed Mar 27, 2017
1 parent b0e251a commit ca2b25f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# generator-craftplugin Changelog

## 1.2.32 - 2017.03.27
### Added
* Added an example of accessing a plugin's settings from a service

## 1.2.31 - 2017.03.25
### Changed
* Fixed the docblock for the `install` migration
Expand Down
1 change: 0 additions & 1 deletion app/templates/api_version_3_0/src/_Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ public function defineTemplateComponent()
// =========================================================================

<% if (pluginComponents.indexOf('settings') >= 0){ -%>

<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
/**
* Creates and returns the model used to store the plugin’s settings.
Expand Down
8 changes: 8 additions & 0 deletions app/templates/api_version_3_0/src/services/_Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ class <%= serviceName[index] %> extends Component
public function exampleService()
{
$result = 'something';
<% if (pluginComponents.indexOf('settings') >= 0){ -%>
// Check our Plugin's settings for `someField`
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
<% } else { -%>
<% } -%>
if (<%= pluginHandle %>::$plugin->getSettings()->someField) {
}
<% } -%>

return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-craftplugin",
"version": "1.2.31",
"version": "1.2.32",
"description": "generator-craftplugin is a Yeoman generator for Craft CMS plugins",
"main": "app/index.js",
"files": [
Expand Down

0 comments on commit ca2b25f

Please sign in to comment.