diff --git a/code/model/editableformfields/EditableTextField.php b/code/model/editableformfields/EditableTextField.php index 957005a..05d8e11 100755 --- a/code/model/editableformfields/EditableTextField.php +++ b/code/model/editableformfields/EditableTextField.php @@ -14,11 +14,42 @@ class EditableTextField extends EditableFormField private static $plural_name = 'Text Fields'; + private static $autocomplete_options = array( + 'off' => 'Off', + 'on' => 'On', + 'name' => 'Full name', + 'honorific-prefix' => 'Prefix or title', + 'given-name' => 'First name', + 'additional-name' => 'Additional name', + 'family-name' => 'Family name', + 'honorific-suffix' => 'Suffix (e.g Jr.)', + 'nickname' => 'Nickname', + 'email' => 'Email', + 'organization-title' => 'Job title', + 'organization' => 'Organization', + 'street-address' => 'Street address', + 'address-line1' => 'Address line 1', + 'address-line2' => 'Address line 2', + 'address-line3' => 'Address line 3', + 'address-level1' => 'Address level 1', + 'address-level2' => 'Address level 2', + 'address-level3' => 'Address level 3', + 'address-level4' => 'Address level 4', + 'country' => 'Country', + 'country-name' => 'Country name', + 'postal-code' => 'Postal code', + 'bday' => 'Birthday', + 'sex' => 'Gender identity', + 'tel' => 'Telephone number', + 'url' => 'Home page' + ); + private static $db = array( 'MinLength' => 'Int', 'MaxLength' => 'Int', 'Rows' => 'Int(1)', - 'Placeholder' => 'Varchar(255)' + 'Placeholder' => 'Varchar(255)', + 'Autocomplete' => 'Varchar(255)' ); private static $defaults = array( @@ -46,6 +77,19 @@ class EditableTextField extends EditableFormField _t('EditableTextField.PLACEHOLDER', 'Placeholder') ) ); + + $fields->addFieldToTab( + 'Root.Main', + DropdownField::create( + 'Autocomplete', + _t('EditableTextField.AUTOCOMPLETE', 'Autocomplete'), + $this->config()->get('autocomplete_options') + )->setDescription(_t( + 'EditableTextField.AUTOCOMPLETE_DESCRIPTION', + 'Supported browsers will attempt to populate this field automatically with the users information, use to set the value populated' + )) + ); + }); return parent::getCMSFields(); @@ -116,5 +160,10 @@ class EditableTextField extends EditableFormField if ($this->Placeholder) { $field->setAttribute('placeholder', $this->Placeholder); } + + if ($this->Autocomplete) { + $field->setAttribute('autocomplete', $this->Autocomplete); + } + } } diff --git a/lang/de_DE.yml b/lang/de_DE.yml index 82c62b1..8957693 100644 --- a/lang/de_DE.yml +++ b/lang/de_DE.yml @@ -108,6 +108,8 @@ de_DE: PLURALNAME: 'Radio-Buttons' SINGULARNAME: 'Radio-Button' EditableTextField: + AUTOCOMPLETE: 'Automatisch vervollständigen' + AUTOCOMPLETE_DESCRIPTION: 'Unterstützte Browser versuchen, dieses Feld automatisch mit den Benutzerinformationen zu füllen, verwenden, um den gefüllten Wert festzulegen' NUMBERROWS: 'Anzahl der Zeilen' PLACEHOLDER: Platzhalter PLURALNAME: 'Textfelder' diff --git a/lang/en.yml b/lang/en.yml index 2a7b476..baba2a6 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -140,6 +140,8 @@ en: PLURALNAME: 'Radio Groups' SINGULARNAME: 'Radio Group' EditableTextField: + AUTOCOMPLETE: 'Autocomplete' + AUTOCOMPLETE_DESCRIPTION: 'Supported browsers will attempt to populate this field automatically with the users information, use to set the value populated' NUMBERROWS: 'Number of rows' NUMBERROWS_DESCRIPTION: 'Fields with more than one row will be generated as a textarea' PLACEHOLDER: Placeholder diff --git a/lang/es_ES.yml b/lang/es_ES.yml index c280298..97e30e0 100644 --- a/lang/es_ES.yml +++ b/lang/es_ES.yml @@ -106,6 +106,8 @@ es_ES: PLURALNAME: 'Opciones editables' SINGULARNAME: 'Opciones editables' EditableTextField: + AUTOCOMPLETE: 'Autocompletar' + AUTOCOMPLETE_DESCRIPTION: 'Los navegadores compatibles intentarán rellenar este campo automáticamente con la información de los usuarios, usarla para establecer el valor poblado' NUMBERROWS: 'Cantidad de filas' PLURALNAME: 'Campos de texto' SINGULARNAME: 'Campo de texto' diff --git a/lang/fr_FR.yml b/lang/fr_FR.yml index 9556a6b..91d9825 100644 --- a/lang/fr_FR.yml +++ b/lang/fr_FR.yml @@ -60,6 +60,9 @@ fr_FR: DELETE: 'Remove this option' DRAG: 'Drag to rearrange order of options' LOCKED: 'These fields cannot be modified' + EditableTextField: + AUTOCOMPLETE: 'Autocomplétion' + AUTOCOMPLETE_DESCRIPTION: 'Les navigateurs pris en charge essaieront de remplir automatiquement ce champ avec les informations des utilisateurs, utilisez pour définir la valeur remplie' Form: FIELDISREQUIRED: '%s is required' SubmittedFileField: diff --git a/lang/it.yml b/lang/it.yml index 330f61e..b476b12 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -140,6 +140,8 @@ it: PLURALNAME: 'Gruppi di pulsanti a scelta singola' SINGULARNAME: 'Gruppo di pulsanti a scelta singola' EditableTextField: + AUTOCOMPLETE: 'completamento automatico' + AUTOCOMPLETE_DESCRIPTION: 'I browser supportati cercheranno di popolare automaticamente questo campo con l'informazione agli utenti, usare per impostare il valore popolata' NUMBERROWS: 'Numero di righe' NUMBERROWS_DESCRIPTION: 'Campi con più di una riga verranno generati come area testo' PLACEHOLDER: Segnaposto diff --git a/lang/pl_PL.yml b/lang/pl_PL.yml index 516551f..42679d5 100644 --- a/lang/pl_PL.yml +++ b/lang/pl_PL.yml @@ -103,6 +103,8 @@ pl_PL: PLURALNAME: 'Pola wyboru' SINGULARNAME: 'Pole wyboru' EditableTextField: + AUTOCOMPLETE: 'autouzupełnienie' + AUTOCOMPLETE_DESCRIPTION: 'Obsługiwane przeglądarki podejmie próbę wypełnienia tego pola automatycznie z informacji użytkowników, należy ustawić wartość zaludnionych' NUMBERROWS: 'Liczba wierszy' PLURALNAME: 'Pola tekstowe' SINGULARNAME: 'Pole tekstowe' diff --git a/lang/ru_RU.yml b/lang/ru_RU.yml index f5f263e..574e230 100644 --- a/lang/ru_RU.yml +++ b/lang/ru_RU.yml @@ -60,6 +60,9 @@ ru_RU: DELETE: 'Remove this option' DRAG: 'Drag to rearrange order of options' LOCKED: 'These fields cannot be modified' + EditableTextField: + AUTOCOMPLETE: 'автозаполнения' + AUTOCOMPLETE_DESCRIPTION: 'Поддерживаемые браузеры будут пытаться автоматически заполнять это поле с информацией пользователей, используйте для установки значения населенную' Form: FIELDISREQUIRED: '%s is required' SubmittedFileField: