-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a16ff8d
Showing
11 changed files
with
511 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Statamic Language (ISO 639) Dropdown Fieldtype | ||
|
||
 | ||
> The simplest way to list every available langue as a selectable dropdown 🤘 | ||
## Features | ||
- Displays a select field with **every ISO 639 language**. | ||
- Set a **placeholder**. | ||
- Allow **multiple selections**. | ||
- Set a **maximum number of selectable items**. | ||
- Enable **searching** through possible options. | ||
|
||
## Getting Started | ||
|
||
We have made things easy for you start. | ||
|
||
1. **Install the addon** | ||
This can be achieve by downloading our latest release and configuring the package as a path repository in your `composer.json` file. | ||
|
||
|
||
2. **Add the Language ISO 639 select fieldtype.** | ||
Choose your display and hanlde values. | ||
Customize the behavior using our various fieldtypes settings. | ||
|
||
|
||
3. **Enjoy.** | ||
|
||
## What does your addon look like? | ||
|
||
 | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "parfaitementweb/statamic-language-iso639-fieldtype", | ||
"description": "Language dropdown with all ISO639 options values", | ||
"autoload": { | ||
"psr-4": { | ||
"Parfaitementweb\\StatamicLanguageIso639Fieldtype\\": "src" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Alexis Serneels" | ||
} | ||
], | ||
"support": { | ||
"email": "[email protected]" | ||
}, | ||
"extra": { | ||
"statamic": { | ||
"name": "Language Selector Fieldtype", | ||
"description": "Language Selector Fieldtype" | ||
}, | ||
"laravel": { | ||
"providers": [ | ||
"Parfaitementweb\\StatamicLanguageIso639Fieldtype\\ServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"/public/js/addon.js": "/public/js/addon.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "parfaitementweb/statamic-language-iso639-fieldtype", | ||
"description": "Statamic fieldtype to select a language (ISO 639) in a dropdown", | ||
"scripts": { | ||
"dev": "npm run development", | ||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", | ||
"watch": "npm run development -- --watch", | ||
"watch-poll": "npm run watch -- --watch-poll", | ||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", | ||
"prod": "npm run production", | ||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^9.7.6", | ||
"cross-env": "^5.1", | ||
"laravel-mix": "^4.0", | ||
"postcss-import": "^12.0.1", | ||
"postcss-nested": "^4.2.1", | ||
"postcss-preset-env": "^6.7.0", | ||
"vue-template-compiler": "^2.6.12" | ||
}, | ||
"dependencies": {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Parfaitementweb\StatamicLanguageIso639Fieldtype\Fieldtypes; | ||
|
||
use Statamic\Fields\Fieldtype; | ||
use Statamic\Fieldtypes\Select; | ||
use Statamic\Support\Arr; | ||
|
||
class LanguageSelector extends Select | ||
{ | ||
protected $icon = 'earth'; | ||
|
||
protected $categories = ['text']; | ||
|
||
public static function title() | ||
{ | ||
return 'Language ISO 639 select'; | ||
} | ||
|
||
protected function configFieldItems(): array | ||
{ | ||
return [ | ||
'placeholder' => [ | ||
'display' => __('Placeholder'), | ||
'instructions' => __('statamic::fieldtypes.select.config.placeholder'), | ||
'type' => 'text', | ||
'default' => '', | ||
'width' => 50, | ||
], | ||
'multiple' => [ | ||
'display' => __('Multiple'), | ||
'instructions' => __('statamic::fieldtypes.select.config.multiple'), | ||
'type' => 'toggle', | ||
'default' => false, | ||
'width' => 50, | ||
], | ||
'max_items' => [ | ||
'display' => __('Max Items'), | ||
'instructions' => __('statamic::messages.max_items_instructions'), | ||
'type' => 'integer', | ||
'width' => 50, | ||
], | ||
'searchable' => [ | ||
'display' => __('Searchable'), | ||
'instructions' => __('statamic::fieldtypes.select.config.searchable'), | ||
'type' => 'toggle', | ||
'default' => true, | ||
'width' => 50, | ||
] | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Parfaitementweb\StatamicLanguageIso639Fieldtype; | ||
|
||
use Parfaitementweb\StatamicLanguageIso639Fieldtype\FieldTypes\LanguageSelector; | ||
use Statamic\Providers\AddonServiceProvider; | ||
use Statamic\Statamic; | ||
|
||
class ServiceProvider extends AddonServiceProvider | ||
{ | ||
protected $scripts = [ | ||
__DIR__ . '/../public/js/addon.js' | ||
]; | ||
|
||
protected $fieldtypes = [ | ||
LanguageSelector::class, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import LanguageSelector from '../js/components/fieldtypes/LanguageSelector'; | ||
|
||
Statamic.booting(() => { | ||
Statamic.$components.register('language_selector-fieldtype', LanguageSelector); | ||
}); |
Oops, something went wrong.