Resumo de IA
Descrição
The wpforms_field_properties filter fires on form load to display the field properties such as labels, sublabels, and descriptions above the form field.
Parâmetros
- $properties
- (array) An array of field properties such as labels, sublabels and description.
- $field
- (array) Sanitized field data.
- $form_data
- (array) Configurações/dados do formulário processados, preparados para uso posterior.
Fonte
wpforms/includes/fields/class-base.php
Mais Informações
The filter is applied to an array for specific form field properties. Using this filter will change every form field.
Each form field will have its own unique filter name. See the section below for a complete list of documented examples. For example, if you only wanted to change the Email form field, you’d use wpforms_field_properties_email.
Exemplos
In the example below, the function will have the field Description displayed above the field itself but only for the form ID 225.
/**
* Move the field description above the form field.
*
* @link https://wpforms.com/developers/wpforms_field_properties/
*
* @param array $properties Field properties.
* @param array $field Field settings.
* @param array $form_data Form data and settings.
*
* @return array
*/
function wpf_dev_field_properties( $properties, $field, $form_data ) {
// Only process this snippet on the form ID 225
if ( absint( $form_data[ 'id' ] ) !== 225 ) {
return $properties;
}
// move the field description from under the form field to above the form field
$properties[ 'description' ][ 'position' ] = 'before';
return $properties;
}
add_filter( 'wpforms_field_properties', 'wpf_dev_field_properties', 10, 3 );
Artigos de Referência
- Como Posicionar a Descrição do Campo Acima do Campo do Formulário
- How to Change Sublabels for the Email Field
- Como Processar Smart Tags em Campos HTML
- Como Alterar Sub-rótulos para o Campo de Nome
- Como Alterar os Subrótulos do Campo de Endereço
- Como Alterar os Subtítulos do Campo de Senha
- Como Alterar o Atributo Name de um Campo Oculto