Select
Select element, for selecting a single value from a list.
Read View | Edit View |
---|---|
Constructor
/**
* @param $id - See BaseElement definitions
* @param string $label - See BaseElement definitions
* @param array $options - A value => label array. Eg [value1 => label1, value2 => label2]
* @param array $permissions - View, edit, read rights of the elemenet.
See WpooWPermissions in the Overview section.
*/
function __construct($id, $label, $options, $permissions=[])
Usage example
// Declaring
$availableBookAuthors = [
"Nelson_Mandela" => "Nelson Mandela",
"Suzanne_Collins" => "Suzanne Collins",
"Timothy_Keller" => "Timothy Keller"
]
$bookAuthors = new Select("_bookAuthors", "Book Authors", $availableBookAuthors);
$bookReviewPostType->AddField($bookAuthors);
// Fetching Data
foreach ($bookReviewPostType->Query()->Select()->Fetch() as $row)
{
echo $row["_bookAuthors"]
}