studioespresso/craft-easyaddressfield

此包的最新版本(5.0.2)没有提供许可证信息。

您需要的唯一地址字段

5.0.2 2024-09-09 18:01 UTC

README

Easy Address Field

您需要的唯一地址字段

要求

此插件需要Craft CMS 3.0.0-RC1或更高版本。

安装

要安装插件,请按照以下说明操作。

  1. 打开您的终端并转到您的Craft项目

     cd /path/to/project
    
  2. 然后告诉Composer加载插件

     composer require studioespresso/craft-easyaddressfield
    
  3. 在控制面板中,转到设置→插件,并点击“Easy Address Field”的“安装”按钮。

模板变量

打印地址值

您可以通过以下变量通过Twig访问地址字段的值

field.name
field.street
field.street2
field.postalCode
field.state
field.country // returns the country code
field.getCountryName(craft.app.locale) // returns the coutry's full name, in the country's locale
field.latitude
field.longitude
field.getDirectionsUrl() // get a directions link to the given address

从Craft 4升级到Craft 5

getDirectionsUrl()

如果您在craft.address上使用getDirectionsUrl()函数,现在您需要在该字段本身上调用该函数,而不是在插件的Twig变量上。

getStaticMap() & getStaticMapRaw()

这些函数已被从插件中移除,您需要自己替换这些函数。

Studio Espresso 提供