PHP Класс Symfony\Component\DomCrawler\Form

Автор: Fabien Potencier ([email protected])
Наследование: extends Symfony\Component\DomCrawler\Link, implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( DOMElement $node, string $currentUri, string $method = null, string $baseHref = null ) Constructor.
all ( ) : FormField[] Gets all fields.
disableValidation ( ) : self Disables validation.
get ( string $name ) : FormField Gets a named field.
getFiles ( ) : array Gets the file field values.
getFormNode ( ) : DOMElement Gets the form node associated with this form.
getMethod ( ) : string Gets the form method.
getPhpFiles ( ) : array Gets the file field values as PHP.
getPhpValues ( ) : array Gets the field values as PHP.
getUri ( ) : string Gets the URI of the form.
getValues ( ) : array Gets the field values.
has ( string $name ) : boolean Returns true if the named field exists.
offsetExists ( string $name ) : boolean Returns true if the named field exists.
offsetGet ( string $name ) : FormField Gets the value of a field.
offsetSet ( string $name, string | array $value ) Sets the value of a field.
offsetUnset ( string $name ) Removes a field from the form.
remove ( string $name ) Removes a field from the form.
set ( FormField $field ) Sets a named field.
setValues ( array $values ) : Form Sets the value of the fields.

Защищенные методы

Метод Описание
getRawUri ( )
setNode ( DOMElement $node ) Sets the node for the form.

Приватные методы

Метод Описание
addField ( DOMElement $node )
initialize ( ) Adds form elements related to this form.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( DOMElement $node, string $currentUri, string $method = null, string $baseHref = null )
$node DOMElement A \DOMElement instance
$currentUri string The URI of the page where the form is embedded
$method string The method to use for the link (if null, it defaults to the method defined by the form)
$baseHref string The URI of the used for relative links, but not for empty action

all() публичный Метод

Gets all fields.
public all ( ) : FormField[]
Результат Symfony\Component\DomCrawler\Field\FormField[] An array of fields

disableValidation() публичный Метод

Disables validation.
public disableValidation ( ) : self
Результат self

get() публичный Метод

Gets a named field.
public get ( string $name ) : FormField
$name string The field name
Результат Symfony\Component\DomCrawler\Field\FormField The field instance

getFiles() публичный Метод

Gets the file field values.
public getFiles ( ) : array
Результат array An array of file field values

getFormNode() публичный Метод

Gets the form node associated with this form.
public getFormNode ( ) : DOMElement
Результат DOMElement A \DOMElement instance

getMethod() публичный Метод

If no method is defined in the form, GET is returned.
public getMethod ( ) : string
Результат string The method

getPhpFiles() публичный Метод

This method converts fields with the array notation (like foo[bar] to arrays) like PHP does. The returned array is consistent with the array for field values (@see getPhpValues), rather than uploaded files found in $_FILES. For a compound file field foo[bar] it will create foo[bar][name], instead of foo[name][bar] which would be found in $_FILES.
public getPhpFiles ( ) : array
Результат array An array of file field values

getPhpValues() публичный Метод

This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.
public getPhpValues ( ) : array
Результат array An array of field values

getRawUri() защищенный Метод

protected getRawUri ( )

getUri() публичный Метод

The returned URI is not the same as the form "action" attribute. This method merges the value if the method is GET to mimics browser behavior.
public getUri ( ) : string
Результат string The URI

getValues() публичный Метод

The returned array does not include file fields (@see getFiles).
public getValues ( ) : array
Результат array An array of field values

has() публичный Метод

Returns true if the named field exists.
public has ( string $name ) : boolean
$name string The field name
Результат boolean true if the field exists, false otherwise

offsetExists() публичный Метод

Returns true if the named field exists.
public offsetExists ( string $name ) : boolean
$name string The field name
Результат boolean true if the field exists, false otherwise

offsetGet() публичный Метод

Gets the value of a field.
public offsetGet ( string $name ) : FormField
$name string The field name
Результат Symfony\Component\DomCrawler\Field\FormField The associated Field instance

offsetSet() публичный Метод

Sets the value of a field.
public offsetSet ( string $name, string | array $value )
$name string The field name
$value string | array The value of the field

offsetUnset() публичный Метод

Removes a field from the form.
public offsetUnset ( string $name )
$name string The field name

remove() публичный Метод

Removes a field from the form.
public remove ( string $name )
$name string The field name

set() публичный Метод

Sets a named field.
public set ( FormField $field )
$field Symfony\Component\DomCrawler\Field\FormField The field

setNode() защищенный Метод

Expects a 'submit' button \DOMElement and finds the corresponding form element, or the form element itself.
protected setNode ( DOMElement $node )
$node DOMElement A \DOMElement instance

setValues() публичный Метод

Sets the value of the fields.
public setValues ( array $values ) : Form
$values array An array of field values
Результат Form