Class luya\cms\menu\QueryIteratorFilter

Inheritanceluya\cms\menu\QueryIteratorFilter » FilterIterator
ImplementsArrayAccess, Countable
Available since version1.0.0
Source Code https://github.com/luyadev/luya-module-cms/blob/master/src/menu/QueryIteratorFilter.php

Iterator filter to verify valid events

Public Methods

Hide inherited methods

Method Description Defined By
accept() Verifys if an menu item does have valid event response. luya\cms\menu\QueryIteratorFilter
column() Returns an array with the value of the column name. luya\cms\menu\QueryIteratorFilter
count() Callculate to number of items when using count() function against the QueryIterator object. luya\cms\menu\QueryIteratorFilter
offsetExists() luya\cms\menu\QueryIteratorFilter
offsetGet() luya\cms\menu\QueryIteratorFilter
offsetSet() luya\cms\menu\QueryIteratorFilter
offsetUnset() luya\cms\menu\QueryIteratorFilter

Method Details

Hide inherited methods

accept() public method

Verifys if an menu item does have valid event response.

{@inheritDoc}

See also \FilterIterator::accept().

public void accept ( )

                #[\ReturnTypeWillChange]
public function accept()
{
    $event = new MenuItemEvent();
    $event->item = $this->current();
    if (isset($this->getInnerIterator()->with['hidden'])) {
        $event->visible = true;
    }
    Yii::$app->menu->trigger(Menu::EVENT_ON_ITEM_FIND, $event);
    return $event->visible;
}

            
column() public method (available since version 3.1.0)

Returns an array with the value of the column name.

$ids = Yii::$app->find()->container('root')->all()->column('id');

The above example contains an array with all ids matching the given condition.

public array column ( $name )
$name string
return array

An array with the values of the given column name.

                public function column($name)
{
    return ArrayHelper::getColumn($this->getInnerIterator()->data, $name);
}

            
count() public method

Callculate to number of items when using count() function against the QueryIterator object.

Use iterator_count in order to ensure the filtered items are counted as well.

public integer count ( )
return integer

The number of elements in the iterator.

                #[\ReturnTypeWillChange]
public function count()
{
    return iterator_count($this);
}

            
offsetExists() public method (available since version 3.2.0)

public void offsetExists ( $offset )
$offset

                #[\ReturnTypeWillChange]
public function offsetExists($offset)
{
    return isset($this->getInnerIterator()->data[$offset]);
}

            
offsetGet() public method (available since version 3.2.0)

public void offsetGet ( $offset )
$offset

                #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
    return isset($this->getInnerIterator()->data[$offset]) ? $this->getInnerIterator()->generateItem($this->getInnerIterator()->data[$offset]) : null;
}

            
offsetSet() public method (available since version 3.2.0)

public void offsetSet ( $offset, $value )
$offset
$value

                #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
    $this->getInnerIterator()->data[$offset] = $value;
}

            
offsetUnset() public method (available since version 3.2.0)

public void offsetUnset ( $offset )
$offset

                #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
    unset($this->getInnerIterator()->data[$offset]);
}