承接 la-haute-societe/craft-locale-selector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

la-haute-societe/craft-locale-selector

Composer 安装命令:

composer require la-haute-societe/craft-locale-selector

包简介

A Craft field type for selecting a site or a country

README 文档

README

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 5.0.0 or later and PHP 8.2+.

Installation

The plugin can be installed from the integrated plugin store by searching for "Locale selector" or using Composer:

  1. Open your terminal and navigate to your Craft project:
    cd /path/to/project
  2. Then tell Composer to load the plugin:
    composer require la-haute-societe/craft-locale-selector
  3. Finally, install and enable the plugin:
    ./craft plugin/install locale-selector
    ./craft plugin/enable locale-selector

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.

{{ entry.myCountryField }}

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.

{{ entry.mySiteField }}

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 site
  • name - [string]: The name of the site
  • language - [string]: The language code of the site as selected in the CP (example: fr-FR or en)
  • baseUrl - [string]: The site base URL
  • handle - [string]: The site handle

Countries

Countries expose the following properties:

  • name - [string]: The localized name of the country
  • nativeName - [string]: The name of the country, in the country main language
  • iso2 - [string]: The 2-letter country code, according to ISO 3166
  • iso3 - [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)

Brought to you by
Logo La Haute Société

统计信息

  • 总下载量: 323
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-06-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固