From 9f208ead5a8a85e2555e688d0fdecc3eeb95598e Mon Sep 17 00:00:00 2001 From: Antonio Almeida Date: Sun, 13 Feb 2022 19:00:20 +0000 Subject: [PATCH 1/4] Add Backpack v5 support --- .DS_Store | Bin 6148 -> 0 bytes composer.json | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Sun, 13 Feb 2022 19:00:53 +0000 Subject: [PATCH 2/4] Apply fixes from StyleCI --- .../Controllers/LanguageCrudController.php | 3 +- src/app/Services/LangFiles.php | 44 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/app/Http/Controllers/LanguageCrudController.php b/src/app/Http/Controllers/LanguageCrudController.php index c772298..c72c5f2 100644 --- a/src/app/Http/Controllers/LanguageCrudController.php +++ b/src/app/Http/Controllers/LanguageCrudController.php @@ -97,8 +97,7 @@ public function store() /** * After delete remove also the language folder. * - * @param int $id - * + * @param int $id * @return string */ public function destroy($id) diff --git a/src/app/Services/LangFiles.php b/src/app/Services/LangFiles.php index b5d64f0..4370a2d 100644 --- a/src/app/Services/LangFiles.php +++ b/src/app/Services/LangFiles.php @@ -29,7 +29,8 @@ public function setFile($file) /** * Get the content of a language file as an array sorted ascending. - * @return array|false + * + * @return array|false */ public function getFileContent() { @@ -47,8 +48,9 @@ public function getFileContent() /** * Rewrite the file with the modified texts. - * @param array $postArray the data received from the form - * @return int + * + * @param array $postArray the data received from the form + * @return int */ public function setFileContent($postArray) { @@ -65,7 +67,8 @@ public function setFileContent($postArray) /** * Get the language files that can be edited, * to ignore a file add it in the config/admin file to language_ignore key. - * @return array + * + * @return array */ public function getlangFiles() { @@ -94,8 +97,9 @@ public function getlangFiles() /** * Check if all the fields were completed. - * @param array $postArray the array containing the data - * @return array + * + * @param array $postArray the array containing the data + * @return array */ public function testFields($postArray) { @@ -122,11 +126,12 @@ public function testFields($postArray) /** * Display the form that permits the editing. - * @param array $fileArray the array with all the texts - * @param array $parents all the ancestor keys of the current key - * @param string $parent the parent key of the current key - * @param int $level the current level - * @return void + * + * @param array $fileArray the array with all the texts + * @param array $parents all the ancestor keys of the current key + * @param string $parent the parent key of the current key + * @param int $level the current level + * @return void */ public function displayInputs($fileArray, $parents = [], $parent = '', $level = 0) { @@ -157,7 +162,8 @@ public function displayInputs($fileArray, $parents = [], $parent = '', $level = /** * Create the array that will be saved in the file. - * @param array $postArray The array to be transformed + * + * @param array $postArray The array to be transformed * @return array */ private function prepareContent($postArray) @@ -194,8 +200,9 @@ function ($item1, $item2) { /** * Add filters to the values inserted by the user. - * @param string $str the string to be sanitized - * @return string + * + * @param string $str the string to be sanitized + * @return string */ private function sanitize($str) { @@ -204,10 +211,11 @@ private function sanitize($str) /** * Set a value in a multidimensional array when knowing the keys. - * @param array $data the array that will be modified - * @param array $keys the keys (path) - * @param string $value the value to be added - * @return array + * + * @param array $data the array that will be modified + * @param array $keys the keys (path) + * @param string $value the value to be added + * @return array */ private function setArrayValue(&$data, $keys, $value) { From 00694fc08f793733fc0a667c786a2d2b8661030b Mon Sep 17 00:00:00 2001 From: Antonio Almeida Date: Sun, 6 Mar 2022 01:09:08 +0000 Subject: [PATCH 3/4] Browse field is not available on pro --- src/app/Http/Controllers/LanguageCrudController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Http/Controllers/LanguageCrudController.php b/src/app/Http/Controllers/LanguageCrudController.php index c772298..420d61b 100644 --- a/src/app/Http/Controllers/LanguageCrudController.php +++ b/src/app/Http/Controllers/LanguageCrudController.php @@ -65,7 +65,7 @@ public function setupCreateOperation() $this->crud->addField([ 'name' => 'flag', 'label' => trans('backpack::langfilemanager.flag_image'), - 'type' => 'browse', + 'type' => backpack_pro() ? 'browse' : 'text', ]); $this->crud->addField([ 'name' => 'active', From 70306a14bfab96d3e5e8b9c815b2d4c274b6a849 Mon Sep 17 00:00:00 2001 From: Antonio Almeida Date: Mon, 7 Mar 2022 00:11:33 +0000 Subject: [PATCH 4/4] Updated upgrade guide --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d651f69..ed31a59 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ _**Note:** this interface allows the admin to directly edit the language files s > ### Security updates and breaking changes > Please **[subscribe to the Backpack Newsletter](http://backpackforlaravel.com/newsletter)** so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months. -## Install in Backpack 4.1 (Laravel 6 or 7) +## Upgrading from 3.x to 4.x + +- Flags are no longer supported on the Language CRUD, until version 3 admins could browse an image for the language flag, we now recommend developers to setup those images in advance, having them in a public folder like `public\flags\en.svg` `public\flags\ro.svg`. + +## Install in Backpack 4.1 or 5.0 (Laravel 6, 7, 8 or 9) ### Step 1. Install via Composer @@ -93,7 +97,7 @@ Or just try at **your-project-domain/admin/language/texts** ## Screenshots -See http://laravelbackpack.com +See https://backpackforlaravel.com/ ## Change log