PHP Class Craft\NeoFieldType

Inheritance: extends craft\BaseFieldType, implements craft\IEagerLoadingFieldType
Mostra file Open project: benjamminf/craft-neo

Public Methods

Method Description
defineContentAttribute ( ) : boolean Disables using the built-in content column for storing values. We will manage field values ourselves.
getEagerLoadingMap ( craft\BaseElementModel[] $sourceElements ) : array Returns an array that maps source-to-target element IDs based on this custom field.
getInputHtml ( string $name, array $value ) : string Builds the HTML for the input field.
getName ( ) Public methods
getSearchKeywords ( array $value ) : string Returns the search keywords that should be associated with this field.
getSettingsHtml ( ) : string Builds the HTML for the configurator.
getStaticHtml ( array $value ) : string Builds the HTML for the non-editable input field.
modifyElementsQuery ( craft\DbCommand $query, mixed $value ) : boolean | null Modifies the element query.
onAfterElementSave ( )
onAfterSave ( ) Saves the actual field type settings after the field type is saved.
onBeforeDelete ( ) Cleans up the field and all it's settings after it gets deleted.
prepSettings ( array $settings ) : Neo_SettingsModel Prepares the Neo field settings before they're saved to the database.
prepValue ( array $value ) : Neo_CriteriaModel Prepares the field's value for use in templates.
prepValueFromPost ( array $data ) : array Converts the field's input value from post data to what it should be stored as in the database.
validate ( array $blocks ) : array | boolean Validates the field's value (blocks).

Protected Methods

Method Description
getSettingsModel ( ) Protected methods

Private Methods

Method Description
_getNamespaceDepth ( ) : integer Returns what current depth the field is nested.
_includeResources ( string $class, array $settings = [] ) Includes the resource (Javascript) files for when outputting the settings or input HTML.
_prepareInputHtml ( integer $id, string $name, array $settings, array $value, boolean | false $static = false ) Actually builds the HTML for the input field. The other one just calls this method.

Method Details

defineContentAttribute() public method

Disables using the built-in content column for storing values. We will manage field values ourselves.
public defineContentAttribute ( ) : boolean
return boolean

getEagerLoadingMap() public method

Returns an array that maps source-to-target element IDs based on this custom field.
public getEagerLoadingMap ( craft\BaseElementModel[] $sourceElements ) : array
$sourceElements craft\BaseElementModel[]
return array

getInputHtml() public method

Builds the HTML for the input field.
public getInputHtml ( string $name, array $value ) : string
$name string
$value array
return string

getName() public method

Public methods
public getName ( )

getSearchKeywords() public method

Returns the search keywords that should be associated with this field.
public getSearchKeywords ( array $value ) : string
$value array
return string

getSettingsHtml() public method

Builds the HTML for the configurator.
public getSettingsHtml ( ) : string
return string

getSettingsModel() protected method

Protected methods
protected getSettingsModel ( )

getStaticHtml() public method

Builds the HTML for the non-editable input field.
public getStaticHtml ( array $value ) : string
$value array
return string

modifyElementsQuery() public method

Modifies the element query.
public modifyElementsQuery ( craft\DbCommand $query, mixed $value ) : boolean | null
$query craft\DbCommand
$value mixed
return boolean | null

onAfterElementSave() public method

public onAfterElementSave ( )

onAfterSave() public method

Saves the actual field type settings after the field type is saved.
public onAfterSave ( )

onBeforeDelete() public method

Cleans up the field and all it's settings after it gets deleted.
public onBeforeDelete ( )

prepSettings() public method

Handles preparing block types, field layouts and groups.
public prepSettings ( array $settings ) : Neo_SettingsModel
$settings array
return Neo_SettingsModel

prepValue() public method

Prepares the field's value for use in templates.
public prepValue ( array $value ) : Neo_CriteriaModel
$value array
return Neo_CriteriaModel

prepValueFromPost() public method

Converts the field's input value from post data to what it should be stored as in the database.
public prepValueFromPost ( array $data ) : array
$data array
return array

validate() public method

Validates the field's value (blocks).
public validate ( array $blocks ) : array | boolean
$blocks array
return array | boolean