InputfieldSelect class

Selection of a single value from a select pulldown

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

Show class?             Show args?        

Common

NameReturnSummary 
InputfieldSelect::addOption(string $value)
$thisAdd an option that may be selected 
InputfieldSelect::addOptionAttributes($key)
$thisAdd attributes for an item (without removing existing attributes), or for multiple items 
InputfieldSelect::addOptionLabel($value, string $label)
$thisAdd selectable option with label, optionally for specific language 
InputfieldSelect::addOptions(array $options)
$thisAdd multiple options at once 
InputfieldSelect::addOptionsString(string $value)
$thisGiven a multi-line string, convert it to options, one per line 
InputfieldSelect::defaultValue string int 
InputfieldSelect::get(string $key)
array mixed nullGet property 
InputfieldSelect::getConfigInputfields()
InputfieldWrapperField configuration
InputfieldSelect::getOptionAttributes()
arrayGet an attributes array intended for an item (or for all items) 
InputfieldSelect::getOptionAttributesString($key)
stringGet an attributes string intended for the <option> element 
InputfieldSelect::getOptions()
arrayGet all options for this Select 
InputfieldSelect::insertOptionsAfter(array $options)
selfInsert new options after an existing option 
InputfieldSelect::insertOptionsBefore(array $options)
selfInsert new options before an existing option (or prepend options to beginning) 
InputfieldSelect::isEmpty()
boolIs the value empty? 
InputfieldSelect::isOption($value)
boolReturns whether the provided value is one of the available options 
InputfieldSelect::isOptionDisabled($value)
boolIs the given option value disabled? 
InputfieldSelect::isOptionSelected($value)
boolReturns whether the provided value is selected 
InputfieldSelect::optionAttributes()
arrayGet or set option attributes
Can also be used as property: InputfieldSelect::optionAttributes
 
InputfieldSelect::optionLabel($key)
string boolGet or set label for given option value/key (default language) 
InputfieldSelect::optionLanguageLabel($language)
string array InputfieldGet or set alternative language label(s) 
InputfieldSelect::options array string Get or set options, array of [value => label], or use options string.  
InputfieldSelect::processInput(WireInputData $input)
$thisProcess input from the provided array
InputfieldSelect::removeOption($value)
$thisRemove the option with the given value 
InputfieldSelect::render()
stringRender and return the output for this Select
InputfieldSelect::renderOptions()
stringRender the given options 
InputfieldSelect::renderReady()
boolRender ready 
InputfieldSelect::renderValue()
stringRender non-editable value
InputfieldSelect::replaceOption($oldValue, $newValue)
boolReplace an option already present with the new value (and optionally new label and attributes) 
InputfieldSelect::set(string $key, mixed $value)
Inputfield InputfieldSelectSet property 
InputfieldSelect::setAttribute($key, $value)
Inputfield InputfieldSelectSet attribute 
InputfieldSelect::setOptionAttributes($key)
$thisSet/replace entire attributes array for an item 
InputfieldSelect::setOptions(array $options)
$thisSet/replace all options 
InputfieldSelect::valueAddOption bool If value attr set from API (only) that is not an option, add it as an option? (default=false) 3.0.171+ 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.236

Latest news

  • ProcessWire Weekly #549
    In the 549th issue of ProcessWire Weekly we’re going to check out the latest core updates, highlight one older yet still very relevant third party module, and more. Read on!
    Weekly.pw / 17 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK