Class luya\cms\menu\QueryIteratorFilter
Inheritance | luya\cms\menu\QueryIteratorFilter » FilterIterator |
---|---|
Implements | ArrayAccess, Countable |
Available since version | 1.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
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
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;
}
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);
}
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);
}
public void offsetExists ( $offset ) | ||
$offset |
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->getInnerIterator()->data[$offset]);
}
public void offsetGet ( $offset ) | ||
$offset |
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->getInnerIterator()->data[$offset]) ? $this->getInnerIterator()->generateItem($this->getInnerIterator()->data[$offset]) : null;
}
public void offsetSet ( $offset, $value ) | ||
$offset | ||
$value |
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->getInnerIterator()->data[$offset] = $value;
}
public void offsetUnset ( $offset ) | ||
$offset |
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->getInnerIterator()->data[$offset]);
}