MultipleOptionsTrait
MultipleOptionsTrait
MultipleOptions
Adds functionaly for types of input that offer users multiple options. Methods are provided for reading options from a variety of sources.
- Full name: \Gibbon\Forms\Traits\MultipleOptionsTrait
Methods
- fromString — Build an internal options array from a provided CSV string.
- fromArray — Build an internal options array from a provided array of $key => $value pairs.
- fromQuery — Build an internal options array from an SQL query with required value and name fields
- fromResults — Build an internal options array from the result set of a PDO query.
- getOptions — Gets the internal options collection.
- getOptionCount — Recursivly count the total options in the collection.
fromString
Build an internal options array from a provided CSV string.
MultipleOptionsTrait::fromString( string $value ): self
Returns Self: This method can be chained.
fromArray
Build an internal options array from a provided array of $key => $value pairs.
MultipleOptionsTrait::fromArray( array $values ): self
Returns Self: This method can be chained.
fromQuery
Build an internal options array from an SQL query with required value and name fields
MultipleOptionsTrait::fromQuery( \Gibbon\Contracts\Database\Connection $pdo, string $sql, array $data = array(), $groupBy = false ): self
Returns Self: This method can be chained.
fromResults
Build an internal options array from the result set of a PDO query.
MultipleOptionsTrait::fromResults( object $results, $groupBy = false ): string
Return Value:
string
getOptions
Gets the internal options collection.
MultipleOptionsTrait::getOptions( ): array
Return Value:
array
getOptionCount
Recursivly count the total options in the collection.
MultipleOptionsTrait::getOptionCount( ): integer
Return Value:
integer