SearchableDropdownTrait
trait SearchableDropdownTrait (View source)
Properties
Methods
Set whether the currently selected value(s) can be cleared
Set whether values are lazy loaded via AJAX
Set the limit of items to lazy load
Get the search context to use If a search context has been set via setSearchContext() that will be used Will fallback to using the dataobjects default search context if a sourceList has been set Otherwise will return null
Set the search context to use instead of the dataobjects default search context
Get whether to use a dynamic placeholder if a normal placeholder is not set
Set whether to use a dynamic placeholder if a normal placeholder is not set
Get whether to use a search context instead searching on labelField
Set whether to use a search context instead searching on labelField
Get whether the field allows searching by typing characters into field
Set whether the field allows searching by typing characters into field
This returns an array rather than a DataList purely to retain compatibility with ancestor getSource()
Get the field to use for the label of the option This field is also used for searching if that field exists in the database and search context is not being used
Set the field to use for the label of the option This field is also used for searching if that field exists in the database and search context is not being used
Set whether the field allows multiple values This is only intended to be called from init() by implemented classes, and not called directly To instantiate a dropdown where only a single value is allowed, use SearchableDropdownField.
Details
        
                            HTTPResponse
    search(HTTPRequest $request)
        
    
    Returns a JSON string of options for lazy loading.
        
                            bool
    getIsClearable()
        
    
    Get whether the currently selected value(s) can be cleared
        
                            SearchableDropdownTrait
    setIsClearable(bool $isClearable)
        
    
    Set whether the currently selected value(s) can be cleared
        
                            bool
    getIsLazyLoaded()
        
    
    Get whether values are lazy loading via AJAX
        
                            SearchableDropdownTrait
    setIsLazyLoaded(bool $isLazyLoaded)
        
    
    Set whether values are lazy loaded via AJAX
        
                            int
    getLazyLoadLimit()
        
    
    Get the limit of items to lazy load
        
                            SearchableDropdownTrait
    setLazyLoadLimit(int $lazyLoadLimit)
        
    
    Set the limit of items to lazy load
        
                            string
    getPlaceholder()
        
    
    Get the placeholder text
        
                            SearchableDropdownTrait
    setPlaceholder(string $placeholder)
        
    
    Set the placeholder text
Calling this will also call setHasEmptyDefault(true), if the method exists on the class, which is required for the placeholder functionality to work on SearchableDropdownField
In the case of SearchableDropField this method should be used instead of setEmptyString()
        
                            SearchContext|null
    getSearchContext()
        
    
    Get the search context to use If a search context has been set via setSearchContext() that will be used Will fallback to using the dataobjects default search context if a sourceList has been set Otherwise will return null
        
                            SearchableDropdownTrait
    setSearchContext(SearchContext|null $searchContext)
        
    
    Set the search context to use instead of the dataobjects default search context
Calling this will also call setUseSearchContext(true)
        
                            bool
    getUseDynamicPlaceholder()
        
    
    Get whether to use a dynamic placeholder if a normal placeholder is not set
        
                            SearchableDropdownTrait
    setUseDynamicPlaceholder(bool $useDynamicPlaceholder)
        
    
    Set whether to use a dynamic placeholder if a normal placeholder is not set
        
                            bool
    getUseSearchContext()
        
    
    Get whether to use a search context instead searching on labelField
If the label field doesn't map to a database field and instead uses a getter e.g. 'MyField' calls a 'getMyField()' method, then search context will be used regardless of what is returned here
        
                            SearchableDropdownTrait
    setUseSearchContext(bool $useSearchContext)
        
    
    Set whether to use a search context instead searching on labelField
If the label field doesn't map to a database field and instead uses a getter e.g. 'MyField' calls a 'getMyField()' method, then search context will be used regardless of what is set here
        
                            bool
    getIsSearchable()
        
    
    Get whether the field allows searching by typing characters into field
        
                            SearchableDropdownTrait
    setIsSearchable(bool $isSearchable)
        
    
    Set whether the field allows searching by typing characters into field
        
                            array
    getSource()
        
    
    This returns an array rather than a DataList purely to retain compatibility with ancestor getSource()
        
                            
    Field($properties = [])
        
    
    No description
        
                            SearchableDropdownTrait
    setSource($source)
        
    
    No description
        
                            string
    getLabelField()
        
    
    Get the field to use for the label of the option This field is also used for searching if that field exists in the database and search context is not being used
If the label field does not map to a database field then a getter will be used if it exists e.g. the default value of 'Title' will map to DataObject::getTitle() if a Title DB field does not exist
        
                            SearchableDropdownTrait
    setLabelField(string $labelField)
        
    
    Set the field to use for the label of the option This field is also used for searching if that field exists in the database and search context is not being used
        
                            array
    getAttributes()
        
    
    No description
        
                            array
    getValueArray()
        
    
    Get a list of selected ID's
        
                            void
    saveInto(DataObjectInterface $record)
        
    
    No description
        
                            string
    getSchemaDataType()
        
    
    No description
        
                            array
    getSchemaDataDefaults()
        
    
    Provide data to the JSON schema for the frontend component
        
                            array
    getSchemaStateDefaults()
        
    
    No description
        
                    protected        SearchableDropdownTrait
    setIsMultiple(bool $isMultiple)
        
    
    Set whether the field allows multiple values This is only intended to be called from init() by implemented classes, and not called directly To instantiate a dropdown where only a single value is allowed, use SearchableDropdownField.
To instantiate a dropdown where multiple values are allowed, use SearchableMultiDropdownField
        
                            
    performReadonlyTransformation()
        
    
    No description