diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/.DS_Store and /dev/null differ 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 diff --git a/composer.json b/composer.json index fe5aa09..2ea30dd 100644 --- a/composer.json +++ b/composer.json @@ -33,10 +33,10 @@ } ], "require": { - "backpack/crud": "^4.1.0" + "backpack/crud": "^5.0" }, "require-dev": { - "phpunit/phpunit" : "4.*", + "phpunit/phpunit" : "^9.0", "scrutinizer/ocular": "~1.1" }, "autoload": { diff --git a/src/app/Http/Controllers/LanguageCrudController.php b/src/app/Http/Controllers/LanguageCrudController.php index c772298..6b40e94 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', @@ -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) {