Message-ID: <2023237979.3364.1485852823660.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3363_984985242.1485852823660" ------=_Part_3363_984985242.1485852823660 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html The Country Field Type

The Country Field Type

This Field Type represents one or multiple countries.

Name Internal name Expected input
Country ezcountry array

Table of contents:

=20 =20

Description

This Field Type makes possible to store and retrieve data representing c= ountries.

Input expectations

Type Example
array
=20
array(
    "JP" =3D> array(
=09    "Name" =3D> "Japan",
        "Alpha2" =3D> "JP",
        "Alpha3" =3D> "JPN",
        "IDC" =3D> 81
    )
);
=20

Note: When you set an array directly on Content field= you don't need to provide all this information, the Field Type will assume= it is a hash and in this case will accept a simplified structure described= below under To / From Ha= sh format.

Validation

This Field Type validates if the multiple countries are allowed by the f= ield definition, and if the Alpha2 is valid according to the countries conf= igured in eZ Platform.

Settings

The field definition of this Field Type can be configured with one optio= n:

Name Type Default value Description
isMultiple boolean false This setting allows (if true) or denies (if fals= e) the selection of multiple countries.
Country FieldType example settings
=20
$settings =3D array(
=09"isMultiple" =3D> true
);
=20

To / From Hash format

The format used for serialization is simpler than the full format, this = is also available when setting value on the content field, by setting the v= alue to an array instead of the Value object. Example of that shown below:<= /p>

Value object content example
=20
$content->fields["countries"] =3D array( "JP", "NO" );
=20

The format used by the toHash method is the Alpha2 value, however the in= put is capable of accepting either Name, Alpha2 or Alpha3 value as shown be= low in the Value object section.

Value object

Properties

The Value class of this field type contains the following properties:

Property Type Description
$countries array[] This property will be used for the= country selection provided as input, as its attributes.
Value object content example
=20
$value->countries =3D array(
    "JP" =3D> array(
        "Name" =3D> "Japan",
        "Alpha2" =3D> "JP",
        "Alpha3" =3D> "JPN",
        "IDC" =3D> 81
    )
)
=20

Constructor

The Country\Value cons= tructor will initialize a new Value object with the value provided. It= expects an array as input.

Constructor example
=20
// Instantiates a Country Value object
$countryValue =3D new Country\Value(
=09array(
    =09"JP" =3D> array(
        =09"Name" =3D> "Japan",
        =09"Alpha2" =3D> "JP",
        =09"Alpha3" =3D> "JPN",
        =09"IDC" =3D> 81
=09=09)
=09)
);
=20
------=_Part_3363_984985242.1485852823660--