diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..e6b195d
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+github: alxndr-w
+ko_fi: alxndr-w
+custom: ['https://www.alexplus.de']
diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml
new file mode 100644
index 0000000..e52b3aa
--- /dev/null
+++ b/.github/workflows/code-style.yml
@@ -0,0 +1,42 @@
+name: PHP-CS-Fixer
+
+on:
+ push:
+ branches: [ master, main ]
+ pull_request:
+ branches: [ master, main ]
+
+permissions:
+ contents: read
+
+jobs:
+ code-style:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write # for Git to git apply
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.1'
+ extensions: gd, intl, pdo_mysql
+ coverage: none # disable xdebug, pcov
+
+ # install dependencies from composer.json
+ - name: Install test dependencies
+ env:
+ COMPOSER: composer.json
+ run: composer install --prefer-dist --no-progress
+
+ # run php-cs-fixer, fix code styles
+ - name: Run PHP CS Fixer
+ run: composer cs-fix
+
+ # commit and push fixed files
+ - uses: stefanzweifel/git-auto-commit-action@v4
+ with:
+ commit_message: Apply php-cs-fixer changes
diff --git a/.github/workflows/publish-to-redaxo-org.yml b/.github/workflows/publish-to-redaxo-org.yml
new file mode 100644
index 0000000..b5aeeb0
--- /dev/null
+++ b/.github/workflows/publish-to-redaxo-org.yml
@@ -0,0 +1,19 @@
+# Instructions: https://github.com/FriendsOfREDAXO/installer-action/
+
+name: Publish to REDAXO.org
+on:
+ release:
+ types:
+ - published
+
+jobs:
+ redaxo_publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: FriendsOfREDAXO/installer-action@v1
+ with:
+ myredaxo-username: ${{ secrets.MYREDAXO_USERNAME }}
+ myredaxo-api-key: ${{ secrets.MYREDAXO_API_KEY }}
+ description: ${{ github.event.release.body }}
+ version: ${{ github.event.release.tag_name }}
diff --git a/.gitignore b/.gitignore
index 9bea433..925011d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-
-.DS_Store
+/composer.lock
+/.php-cs-fixer.cache
+/vendor
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..72be593
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,11 @@
+in(__DIR__)
+;
+
+return (new Redaxo\PhpCsFixerConfig\Config())
+ ->setFinder($finder)
+ ;
diff --git a/LICENSE b/LICENSE
index 0947cd3..f80fd1a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2017 Friends Of REDAXO
+Copyright (c) 2022 alex+ Informationsdesign
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 378f548..be4fd94 100755
--- a/README.md
+++ b/README.md
@@ -1,67 +1,65 @@
-# Iconpicker-AddOn für REDAXO 5
+# Iconpicker (Bootstrap Icons, FontAwesome 6) für REDAXO
-⚠️ Entwicklung eingestellt: Das AddOn wird an dieser Stelle nicht länger gepflegt. / Deprecated: this addOn won’t be maintained any longer.
-Als Alternative mit mehr Funktionalität empfiehlt sich: fa_iconpicker(https://github.com/FriendsOfREDAXO/fa_iconpicker).
+Stellt Icons von
Das Iconpicker-AddOn verwendet folgendes Skript:
-http://mjolnic.com/fontawesome-iconpicker/
Eventuelle Anpassungen beim Aufruf des Iconpickers können amn besten in die Datei assets/iconpicker.js geschrieben werden.
- -Um den Iconpicker für ein Textfeld zu aktivieren, diesem die CSS-Klasse "icp" zuweisen.
- --'); -?> -- - - -
Damit das Popup nicht abgeschnitten wird, muss der Container form-group die CSS-Eigenschaft overflow: visible
haben.
-Die Position des Popups kann über data-placement
bestimmt werden.
Der vollständiger Beispiel-Code für ein Modul könnte also so aussehen:
- -- - -- --
Um die Icons direkt im Input-Feld zu filtern, wird data-input-search="true"
gesetzt:
-'); -?> -- - - -
Auch die in Bootstrap bekannte Komponente einer "Input group" ist möglich:
- -- - - -'); -?> -- - - - -
Danke an @tbaddade für Inspiration.
diff --git a/install.php b/install.php index e69de29..b3d9bbc 100755 --- a/install.php +++ b/install.php @@ -0,0 +1 @@ +setValue((string) $this->getValue()); + + if ('' == $this->getValue() && !$this->params['send']) { + $this->setValue($this->getElement('default')); + } + + if ($this->needsOutput() && $this->isViewable()) { + $templateParams = []; + if (!$this->isEditable()) { + $attributes = empty($this->getElement('attributes')) ? [] : json_decode($this->getElement('attributes'), true); + $attributes['readonly'] = 'readonly'; + $this->setElement('attributes', json_encode($attributes)); + $this->params['form_output'][$this->getId()] = $this->parse('value.bi_iconpicker.tpl.php', $templateParams); + } else { + $this->params['form_output'][$this->getId()] = $this->parse('value.bi_iconpicker.tpl.php', $templateParams); + } + } + + $this->params['value_pool']['email'][$this->getName()] = $this->getValue(); + + if ($this->saveInDb()) { + $this->params['value_pool']['sql'][$this->getName()] = $this->getValue(); + } + } + + public function getDescription(): string + { + return 'bi_iconpicker|name|label|defaultwert|[no_db]|[attributes]|[notice]|[prepend]'; + } + + public function getDefinitions(): array + { + return [ + 'type' => 'value', + 'name' => 'bi_iconpicker', + 'values' => [ + 'name' => ['type' => 'name', 'label' => rex_i18n::msg('yform_values_defaults_name')], + 'label' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_label')], + 'default' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_text_default')], + 'no_db' => ['type' => 'no_db', 'label' => rex_i18n::msg('yform_values_defaults_table'), 'default' => 0], + 'attributes' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_attributes'), 'notice' => rex_i18n::msg('yform_values_defaults_attributes_notice')], + 'notice' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_notice')], + ], + 'description' => rex_i18n::msg('yform_values_iconpicker_description'), + 'db_type' => ['varchar(191)', 'text'], + 'famous' => false, + 'hooks' => [ + 'preDefault' => static function (rex_yform_manager_field $field) { + return $field->getElement('default'); + }, + ], + ]; + } + + public static function getListValue($params) + { + return ' ' . $params['subject'] . ''; + } +} diff --git a/lib/yform/value/fa6_iconpicker.php b/lib/yform/value/fa6_iconpicker.php new file mode 100644 index 0000000..7e68cb4 --- /dev/null +++ b/lib/yform/value/fa6_iconpicker.php @@ -0,0 +1,65 @@ +setValue((string) $this->getValue()); + + if ('' == $this->getValue() && !$this->params['send']) { + $this->setValue($this->getElement('default')); + } + + if ($this->needsOutput() && $this->isViewable()) { + $templateParams = []; + if (!$this->isEditable()) { + $attributes = empty($this->getElement('attributes')) ? [] : json_decode($this->getElement('attributes'), true); + $attributes['readonly'] = 'readonly'; + $this->setElement('attributes', json_encode($attributes)); + $this->params['form_output'][$this->getId()] = $this->parse('value.fa6_iconpicker.tpl.php', $templateParams); + } else { + $this->params['form_output'][$this->getId()] = $this->parse('value.fa6_iconpicker.tpl.php', $templateParams); + } + } + + $this->params['value_pool']['email'][$this->getName()] = $this->getValue(); + + if ($this->saveInDb()) { + $this->params['value_pool']['sql'][$this->getName()] = $this->getValue(); + } + } + + public function getDescription(): string + { + return 'fa6_iconpicker|name|label|defaultwert|[no_db]|[attributes]|[notice]|[prepend]'; + } + + public function getDefinitions(): array + { + return [ + 'type' => 'value', + 'name' => 'fa6_iconpicker', + 'values' => [ + 'name' => ['type' => 'name', 'label' => rex_i18n::msg('yform_values_defaults_name')], + 'label' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_label')], + 'default' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_text_default')], + 'no_db' => ['type' => 'no_db', 'label' => rex_i18n::msg('yform_values_defaults_table'), 'default' => 0], + 'attributes' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_attributes'), 'notice' => rex_i18n::msg('yform_values_defaults_attributes_notice')], + 'notice' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_notice')], + ], + 'description' => rex_i18n::msg('yform_values_fa6_iconpicker_description'), + 'db_type' => ['varchar(191)', 'text'], + 'famous' => false, + 'hooks' => [ + 'preDefault' => static function (rex_yform_manager_field $field) { + return $field->getElement('default'); + }, + ], + ]; + } + + public static function getListValue($params) + { + return ' ' . $params['subject'] . ''; + } +} diff --git a/package.yml b/package.yml index 58975a7..a850c3f 100755 --- a/package.yml +++ b/package.yml @@ -1,7 +1,14 @@ -package: iconpicker -version: '1.1.0' -author: 'Friends Of REDAXO' -supportpage: https://github.com/FriendsOfREDAXO/iconpicker +package: iconpicker +version: '2.0.0' +author: 'FriendsOfRedaxo, Alexander Walther, Thorben' +supportpage: https://github.com/friendsofredaxo/iconpicker + requires: - redaxo: '^5.6' + php: + version: '>7.3,<9' + redaxo: ^5.17 + +page: + title: translate:iconpicker_title + hidden: true diff --git a/pages/index.php b/pages/index.php deleted file mode 100755 index c8ef4a0..0000000 --- a/pages/index.php +++ /dev/null @@ -1,2 +0,0 @@ -i18n('title')); diff --git a/uninstall.php b/uninstall.php index e69de29..b3d9bbc 100755 --- a/uninstall.php +++ b/uninstall.php @@ -0,0 +1 @@ +getValue(); +} + +$notice = []; +if ('' != $this->getElement('notice')) { + $notice[] = rex_i18n::translate($this->getElement('notice'), false); +} +if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { + $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()]) . ''; // var_dump(); +} +if (count($notice) > 0) { + $notice = '' . implode('
', $notice) . '
' . implode('
', $notice) . '