PHP Class Craft\Neo_CriteriaModel

Inheritance: extends craft\ElementCriteriaModel
Datei anzeigen Open project: benjamminf/craft-neo

Protected Properties

Property Type Description
$filterOrder array This is important as changing the order can affect the results of certain filters, such as limit and offset. It also allows increased performance by allowing filters with high filtering potential to be run earlier.

Public Methods

Method Description
__construct ( array | null $attributes = null ) Initialises the criteria model, forcing the element type to be a Neo block.
copy ( ) : Neo_CriteriaModel Returns a clone of the criteria model.
count ( ) : integer Returns the total number of elements matched by this criteria.
setAllElements ( array $elements ) Sets all the elements (blocks) to be filtered against in Live Preview mode.
setAttribute ( string $name, mixed $value ) : boolean Sets a filter value for the criteria model, then reruns Live Preview filtering.

Protected Methods

Method Description
__ancestorDist ( array $elements, integer $value ) : array
__ancestorOf ( array $elements, Neo_BlockModel $value ) : array
__collapsed ( array $elements, Neo_BlockModel $value ) : array
__descendantDist ( array $elements, integer $value ) : array
__descendantOf ( array $elements, Neo_BlockModel $value ) : array
__fieldId ( array $elements, integer $value ) : array
__id ( array $elements, integer $value ) : array
__level ( array $elements, integer $value ) : array
__limit ( array $elements, integer $value ) : array
__nextSiblingOf ( array $elements, int\Neo_BlockModel $value ) : array
__offset ( array $elements, integer $value ) : array
__positionedAfter ( array $elements, int\Neo_BlockModel $value ) : array
__positionedBefore ( array $elements, int\Neo_BlockModel $value ) : array
__prevSiblingOf ( array $elements, int\Neo_BlockModel $value ) : array
__relatedTo ( array $elements, $value ) : array
__search ( array $elements, $value ) : array
__siblingOf ( array $elements, int\Neo_BlockModel $value ) : array
__status ( array $elements, Neo_BlockModel $value ) : array
__type ( array $elements, string $value ) : array
__typeId ( array $elements, integer $value ) : array
getState ( ) : array Returns all saved, private settings for the criteria model, to be used when copying.
setState ( array\Neo_CriteriaModel $state ) Sets all saved, private settings to the criteria model, to be used when copying.

Private Methods

Method Description
_compareInt ( integer $value, string\int $comparison ) : boolean Compares an integer against a criteria model integer comparison string, or integer.
_getBlock ( int\Neo_BlockModel $block ) : bool\Neo_BlockModel Returns a block model given an ID, or an actual block model.
_indexOfBlock ( array $elements, Neo_BlockModel $block ) : integer Finds the position of a block inside a list of blocks.
_indexOfRootBlock ( array $elements, Neo_BlockModel $block ) : integer Finds the position of the block who is it's furthest ancestor to the passed block.
_runCriteria ( ) Runs Live Preview filtering and saves it's output to the criteria model.

Method Details

__ancestorDist() protected method

protected __ancestorDist ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__ancestorOf() protected method

protected __ancestorOf ( array $elements, Neo_BlockModel $value ) : array
$elements array
$value Neo_BlockModel
return array

__collapsed() protected method

protected __collapsed ( array $elements, Neo_BlockModel $value ) : array
$elements array
$value Neo_BlockModel
return array

__construct() public method

Initialises the criteria model, forcing the element type to be a Neo block.
public __construct ( array | null $attributes = null )
$attributes array | null

__descendantDist() protected method

protected __descendantDist ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__descendantOf() protected method

protected __descendantOf ( array $elements, Neo_BlockModel $value ) : array
$elements array
$value Neo_BlockModel
return array

__fieldId() protected method

protected __fieldId ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__id() protected method

protected __id ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__level() protected method

protected __level ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__limit() protected method

protected __limit ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__nextSiblingOf() protected method

protected __nextSiblingOf ( array $elements, int\Neo_BlockModel $value ) : array
$elements array
$value int\Neo_BlockModel
return array

__offset() protected method

protected __offset ( array $elements, integer $value ) : array
$elements array
$value integer
return array

__positionedAfter() protected method

protected __positionedAfter ( array $elements, int\Neo_BlockModel $value ) : array
$elements array
$value int\Neo_BlockModel
return array

__positionedBefore() protected method

protected __positionedBefore ( array $elements, int\Neo_BlockModel $value ) : array
$elements array
$value int\Neo_BlockModel
return array

__prevSiblingOf() protected method

protected __prevSiblingOf ( array $elements, int\Neo_BlockModel $value ) : array
$elements array
$value int\Neo_BlockModel
return array

__relatedTo() protected method

protected __relatedTo ( array $elements, $value ) : array
$elements array
$value
return array

__siblingOf() protected method

protected __siblingOf ( array $elements, int\Neo_BlockModel $value ) : array
$elements array
$value int\Neo_BlockModel
return array

__status() protected method

protected __status ( array $elements, Neo_BlockModel $value ) : array
$elements array
$value Neo_BlockModel
return array

__type() protected method

protected __type ( array $elements, string $value ) : array
$elements array
$value string
return array

__typeId() protected method

protected __typeId ( array $elements, integer $value ) : array
$elements array
$value integer
return array

copy() public method

Returns a clone of the criteria model.
public copy ( ) : Neo_CriteriaModel
return Neo_CriteriaModel

count() public method

Fixes live preview mode which broke in Craft 2.6.2793 due to this method. If live preview mode is detected, it uses the old method which worked in live preview mode.
public count ( ) : integer
return integer

getState() protected method

Returns all saved, private settings for the criteria model, to be used when copying.
protected getState ( ) : array
return array

setAllElements() public method

This becomes the main data source for Live Preview, instead of the database.
public setAllElements ( array $elements )
$elements array

setAttribute() public method

Sets a filter value for the criteria model, then reruns Live Preview filtering.
public setAttribute ( string $name, mixed $value ) : boolean
$name string
$value mixed
return boolean

setState() protected method

Sets all saved, private settings to the criteria model, to be used when copying.
protected setState ( array\Neo_CriteriaModel $state )
$state array\Neo_CriteriaModel

Property Details

$filterOrder protected_oe property

This is important as changing the order can affect the results of certain filters, such as limit and offset. It also allows increased performance by allowing filters with high filtering potential to be run earlier.
protected array $filterOrder
return array