Download the PHP package la-haute-societe/craft-locale-selector without Composer
On this page you can find all versions of the php package la-haute-societe/craft-locale-selector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download la-haute-societe/craft-locale-selector
More information about la-haute-societe/craft-locale-selector
Files in la-haute-societe/craft-locale-selector
Package craft-locale-selector
Short Description A Craft field type for selecting a site or a country
License proprietary
Informations about the package craft-locale-selector
Craft - Locale selector
This plugin adds a new "Country or Site" field type to the Craft CMS. The Country or site field allows content editors to choose from a list of link types and offers individual input fields for each of them.
Requirements
This plugin requires Craft CMS 4.0.0 or later.
Installation
The plugin can be installed from the integrated plugin store by searching for "Locale selector" or using Composer:
-
Open your terminal and navigate to your Craft project:
-
Then tell Composer to load the plugin:
- Finally, install and enable the plugin:
Usage
After the plugin has been installed, "Country or site" fields can be created using the field settings within the control panel. All field settings can be found within the field manager.
Templating
Countries
Country fields can be rendered directly in Twig, they return the localized name of the selected country.
The field value is actually an instance of
\lhs\craft\localeSelectorField\models\CountryModel
which exposes additional
properties and methods that can be used in templates.
Sites
Site fields can be rendered directly in Twig, they return the name of the site.
The field value is actually an instance of \craft\models\Site
which exposes
additional properties and methods that can be used in templates.
GraphQL
GraphQL is supported 🎉
Sites
Sites expose the following properties:
id
-[string]
: The ID of the sitename
-[string]
: The name of the sitelanguage
-[string]
: The language code of the site as selected in the CP (example:fr-FR
oren
)baseUrl
-[string]
: The site base URLhandle
-[string]
: The site handle
Countries
Countries expose the following properties:
name
-[string]
: The localized name of the countrynativeName
-[string]
: The name of the country, in the country main languageiso2
-[string]
: The 2-letter country code, according to ISO 3166iso3
-[string]
: The 3-letter country code, according to ISO 3166
Roadmap
- Add the ability to select languages
- Add the ability to select locales (language + country)