SelectableOptionArray class

Located in file /wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionArray.php

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the SelectableOptionArray class also inherits all the methods and properties of: WireArray and Wire.

Show class?             Show args?        

Common

NameReturnSummary 
addByID(int $id)
false SelectableOptionAdd by option ID 
addByTitle(string $title)
false SelectableOptionAdd by option title 
addByValue(string $value)
false SelectableOptionAdd by option value 
getByID(int $id)
SelectableOption nullGet option by ID 
getByTitle(string $title)
SelectableOption nullGet option by title 
getByValue(string $value)
SelectableOption nullGet option by value 
getField()
null FieldReturns Field object these options are for 
getItemKey($item)
(nothing) 
getPage()
NullPage PageReturns page these options are for, if applicable (NullPage otherwise) 
getProperty(string $property)
mixed nullEnables this WireArray to behave like the first item (for getting properties) 
hasID(int $id)
SelectableOption boolIs the given id present in these selectable options? 
hasTitle(string $title)
SelectableOption boolIs the given title present in these selectable options? 
hasValue(string $value)
SelectableOption boolIs the given value present in these selectable options? 
id int 
isIdentical(WireArray $items)
boolIs the given WireArray identical to this one? 
isValidItem($item)
boolIs the given item valid for storange in this array? 
isValidKey($key)
boolIs the given item key valid for use in this array? 
makeBlankItem()
(nothing) 
of()
boolGet or set output formatting mode 
removeByID(int $id)
boolRemove option by ID 
removeByTitle(string $title)
boolRemove option by title 
removeByValue(string $value)
boolRemove option by value 
render()
stringProvide a default string rendering of these selectable options 
set($key, $value)
$thisSet an item by key in the WireArray. 
setField(Field $field)
(nothing)Set the field these options are for 
setPage(Page $page)
(nothing)Set the these options live on 
setProperty(string $property, mixed $value)
SelectableOption SelectableOptionArrayEnables this WireArray to behave like the first item (for setting properties) 
title string 
value string 

Additional methods and properties

In addition to the methods and properties above, SelectableOptionArray also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #560
    In the 560th issue of ProcessWire Weekly we'll check out the latest core updates, cover newly released ProcessWire modules, and more. Read on!
    Weekly.pw / 1 February 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer