diff --git a/CHANGELOG.md b/CHANGELOG.md index 680e2cb..dcce3cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ to [Semantic Versioning](http://semver.org/). - Craft CMS 4 ready - Comments cleanup +- fixed version number ## 0.0.3 - 2022-06-10 diff --git a/src/HOMMIcons.php b/src/HOMMIcons.php index a1c9c0b..7fc945c 100644 --- a/src/HOMMIcons.php +++ b/src/HOMMIcons.php @@ -23,19 +23,11 @@ use yii\base\Event; /** - * Craft plugins are very much like little applications in and of themselves. We’ve made - * it as simple as we can, but the training wheels are off. A little prior knowledge is - * going to be required to write a plugin. + * Class HOMMIcons * - * For the purposes of the plugin docs, we’re going to assume that you know PHP and SQL, - * as well as some semi-advanced concepts like object-oriented programming and PHP namespaces. - * - * https://craftcms.com/docs/plugins/introduction - * - * @author Domenik Hofer + * @author Benjamin Ammann * @package HOMMIcons - * @since 1.0.0 - * + * @since 0.0.1 */ class HOMMIcons extends Plugin { @@ -58,7 +50,7 @@ class HOMMIcons extends Plugin * * @var string */ - public string $schemaVersion = '1.0.0-alpha.1'; + public string $schemaVersion = '1.0.0'; /** * @var bool diff --git a/src/assetbundles/hommicons/HOMMIconsAsset.php b/src/assetbundles/hommicons/HOMMIconsAsset.php index 48dffb0..7bdcaf7 100644 --- a/src/assetbundles/hommicons/HOMMIconsAsset.php +++ b/src/assetbundles/hommicons/HOMMIconsAsset.php @@ -10,27 +10,15 @@ namespace homm\hommicons\assetbundles\hommicons; -use Craft; use craft\web\AssetBundle; use craft\web\assets\cp\CpAsset; /** - * HOMMIconsAsset AssetBundle + * Class HOMMIconsAsset * - * AssetBundle represents a collection of asset files, such as CSS, JS, images. - * - * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. - * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) - * of the class representing it. - * - * An asset bundle can depend on other asset bundles. When registering an asset bundle - * with a view, all its dependent asset bundles will be automatically registered. - * - * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html - * - * @author Domenik Hofer + * @author Benjamin Ammann * @package HOMMIcons - * @since 1.0.0 + * @since 0.0.1 */ class HOMMIconsAsset extends AssetBundle { diff --git a/src/assetbundles/hommicons/dist/css/HOMMIconsField.css b/src/assetbundles/hommicons/dist/css/HOMMIconsField.css index 16689b2..602d628 100644 --- a/src/assetbundles/hommicons/dist/css/HOMMIconsField.css +++ b/src/assetbundles/hommicons/dist/css/HOMMIconsField.css @@ -3,11 +3,11 @@ * * HOMMIconsField Field CSS * - * @author Domenik Hofer - * @copyright Copyright (c) 2019 Domenik Hofer + * @author Benjamin Ammann + * @copyright Copyright (c) 2021 Benjamin Ammann * @link https://github.com/HOMMinteractive * @package HOMMIcons - * @since 1.0.0 + * @since 0.0.1 */ .homm-iconpicker { diff --git a/src/assetbundles/hommicons/dist/js/HOMMIconsField.js b/src/assetbundles/hommicons/dist/js/HOMMIconsField.js index d01ccc9..30c50aa 100644 --- a/src/assetbundles/hommicons/dist/js/HOMMIconsField.js +++ b/src/assetbundles/hommicons/dist/js/HOMMIconsField.js @@ -1,13 +1,13 @@ /** - * HOMM Icons plugin for Craft CMS 3.x + HOMM Icons plugin for Craft CMS 3.x * * HOMMIconsField Field JS * - * @author Domenik Hofer - * @copyright Copyright (c) 2019 Domenik Hofer + * @author Benjamin Ammann + * @copyright Copyright (c) 2021 Benjamin Ammann * @link https://github.com/HOMMinteractive * @package HOMMIcons - * @since 1.0.0 + * @since 0.0.1 */ ;(function ($, window, document, undefined) { diff --git a/src/fields/HOMMIconsField.php b/src/fields/HOMMIconsField.php index 86426d1..336526a 100644 --- a/src/fields/HOMMIconsField.php +++ b/src/fields/HOMMIconsField.php @@ -21,17 +21,11 @@ use craft\helpers\Json; /** - * HOMMIconsField Field + * Class HOMMIconsField * - * Whenever someone creates a new field in Craft, they must specify what - * type of field it is. The system comes with a handful of field types baked in, - * and we’ve made it extremely easy for plugins to add new ones. - * - * https://craftcms.com/docs/plugins/field-types - * - * @author Domenik Hofer + * @author Benjamin Ammann * @package HOMMIcons - * @since 1.0.0 + * @since 0.0.1 */ class HOMMIconsField extends Field { @@ -52,33 +46,16 @@ public static function displayName(): string // ========================================================================= /** - * Returns the column type that this field should get within the content table. - * - * This method will only be called if [[hasContentColumn()]] returns true. - * - * @return string The column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called - * to convert the give column type to the physical one. For example, `string` will be converted - * as `varchar(255)` and `string(100)` becomes `varchar(100)`. `not null` will automatically be - * appended as well. - * @see \yii\db\QueryBuilder::getColumnType() + * @inheritdoc */ public function getContentColumnType(): array|string { return Schema::TYPE_STRING; } + /** - * Normalizes the field’s value for use. - * - * This method is called when the field’s value is first accessed from the element. For example, the first time - * `entry.myFieldHandle` is called from a template, or right before [[getInputHtml()]] is called. Whatever - * this method returns is what `entry.myFieldHandle` will likewise return, and what [[getInputHtml()]]’s and - * [[serializeValue()]]’s $value arguments will be set to. - * - * @param mixed $value The raw field value - * @param ElementInterface|null $element The element the field is associated with, if there is one - * - * @return mixed The prepared field value + * @inheritdoc */ public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed { @@ -94,102 +71,9 @@ public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $elem } + /** - * Returns the field’s input HTML. - * - * An extremely simple implementation would be to directly return some HTML: - * - * ```php - * return ''; - * ``` - * - * For more complex inputs, you might prefer to create a template, and render it via - * [[\craft\web\View::renderTemplate()]]. For example, the following code would render a template located at - * craft/plugins/myplugin/templates/_fieldinput.html, passing the $name and $value variables to it: - * - * ```php - * return Craft::$app->getView()->renderTemplate('myplugin/_fieldinput', [ - * 'name' => $name, - * 'value' => $value - * ]); - * ``` - * - * If you need to tie any JavaScript code to your input, it’s important to know that any `name=` and `id=` - * attributes within the returned HTML will probably get [[\craft\web\View::namespaceInputs() namespaced]], - * however your JavaScript code will be left untouched. - * - * For example, if getInputHtml() returns the following HTML: - * - * ```html - * - * - * - * ``` - * - * …then it might actually look like this before getting output to the browser: - * - * ```html - * - * - * - * ``` - * - * As you can see, that JavaScript code will not be able to find the textarea, because the textarea’s `id=` - * attribute was changed from `foo` to `namespace-foo`. - * - * Before you start adding `namespace-` to the beginning of your element ID selectors, keep in mind that the actual - * namespace is going to change depending on the context. Often they are randomly generated. So it’s not quite - * that simple. - * - * Thankfully, [[\craft\web\View]] provides a couple handy methods that can help you deal with this: - * - * - [[\craft\web\View::namespaceInputId()]] will give you the namespaced version of a given ID. - * - [[\craft\web\View::namespaceInputName()]] will give you the namespaced version of a given input name. - * - [[\craft\web\View::formatInputId()]] will format an input name to look more like an ID attribute value. - * - * So here’s what a getInputHtml() method that includes field-targeting JavaScript code might look like: - * - * ```php - * public function getInputHtml($value, $element) - * { - * // Come up with an ID value based on $name - * $id = Craft::$app->getView()->formatInputId($name); - * - * // Figure out what that ID is going to be namespaced into - * $namespacedId = Craft::$app->getView()->namespaceInputId($id); - * - * // Render and return the input template - * return Craft::$app->getView()->renderTemplate('myplugin/_fieldinput', [ - * 'name' => $name, - * 'id' => $id, - * 'namespacedId' => $namespacedId, - * 'value' => $value - * ]); - * } - * ``` - * - * And the _fieldinput.html template might look like this: - * - * ```twig - * - * - * - * ``` - * - * The same principles also apply if you’re including your JavaScript code with - * [[\craft\web\View::registerJs()]]. - * - * @param mixed $value The field’s value. This will either be the [[normalizeValue() normalized value]], - * raw POST data (i.e. if there was a validation error), or null - * @param ElementInterface|null $element The element the field is associated with, if there is one - * - * @return string The input HTML. + * @inheritdoc */ public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $element = null): string { @@ -225,7 +109,7 @@ public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $elemen } /** - * Get the Icons of the volume "bilder" + * Get the Icons of the volume provided by the settings * * @return array the query results. If the query results in nothing, an empty array will be returned. */ diff --git a/src/models/Settings.php b/src/models/Settings.php index 12e98cf..9eb1471 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -13,8 +13,10 @@ use craft\base\Model; /** + * Class Settings + * * @author Benjamin Ammann - * @package HOMMSocialFeed + * @package HOMMIcons * @since 0.0.1 */ class Settings extends Model @@ -25,7 +27,7 @@ class Settings extends Model /** * @var string Icon picker base volume name */ - public $iconsVolume = 'pictures'; + public string $iconsVolume = 'pictures'; // Public Methods // ========================================================================= diff --git a/src/templates/_components/fields/HOMMIconsField_input.twig b/src/templates/_components/fields/HOMMIconsField_input.twig index 7babef5..5b9dcf3 100644 --- a/src/templates/_components/fields/HOMMIconsField_input.twig +++ b/src/templates/_components/fields/HOMMIconsField_input.twig @@ -5,11 +5,11 @@ * * HOMMIconsField Field Input * - * @author Domenik Hofer - * @copyright Copyright (c) 2019 Domenik Hofer + * @author Benjamin Ammann + * @copyright Copyright (c) 2021 Benjamin Ammann * @link https://github.com/HOMMinteractive - * @package HOMMIcons - * @since 1.0.0 + * @package HOMMSocialFeed + * @since 0.0.1 */ #} diff --git a/src/templates/settings.twig b/src/templates/settings.twig index e8f929f..3dfedc0 100644 --- a/src/templates/settings.twig +++ b/src/templates/settings.twig @@ -3,13 +3,13 @@ /** * HOMM Icons plugin for Craft CMS 3.x * - * HOMMIconsField Field Input + * HOMMIcons settings * - * @author Domenik Hofer - * @copyright Copyright (c) 2019 Domenik Hofer + * @author Benjamin Ammann + * @copyright Copyright (c) 2021 Benjamin Ammann * @link https://github.com/HOMMinteractive - * @package HOMMIcons - * @since 1.0.1 + * @package HOMMSocialFeed + * @since 0.0.1 */ #} diff --git a/src/translations/de/hommicons.php b/src/translations/de/hommicons.php index 95a5871..64b61de 100644 --- a/src/translations/de/hommicons.php +++ b/src/translations/de/hommicons.php @@ -11,7 +11,7 @@ /** * @author Benjamin Ammann * @package HOMMIcons - * @since 1.0.1 + * @since 0.0.1 */ return [ '{name} plugin loaded' => '{name} Plugin geladen', diff --git a/src/translations/en/hommicons.php b/src/translations/en/hommicons.php index bd2f5ff..7cd7f9f 100644 --- a/src/translations/en/hommicons.php +++ b/src/translations/en/hommicons.php @@ -9,9 +9,9 @@ */ /** - * @author Domenik Hofer + * @author Benjamin Ammann * @package HOMMIcons - * @since 1.0.0 + * @since 0.0.1 */ return [ '{name} plugin loaded' => '{name} plugin loaded',