本文整理汇总了PHP中DataList::column方法的典型用法代码示例。如果您正苦于以下问题:PHP DataList::column方法的具体用法?PHP DataList::column怎么用?PHP DataList::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataList
的用法示例。
在下文中一共展示了DataList::column方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: constrainGridListFilters
/**
* If HideUnmatchedFilters is on then remove all filters which are not found in the items by their 'AssociatedFilters' relationship.
*
* @param \DataList $filters list of GridListFilter models
* @param array $parameters
* @return \ArrayList
*/
public function constrainGridListFilters(&$filters, &$parameters = [])
{
$out = new \ArrayList();
if ($this()->{self::SingleFieldName}) {
$ids = $filters->column('ID');
if (count($ids)) {
$items = $this()->GridListItems();
// this is where we keep track of GridListFilters which have been found on items where ID is the key
$foundFilters = array_combine($ids, array_fill(0, count($ids), false));
foreach ($foundFilters as $filterID => &$found) {
/** @var \Page|Model $item */
foreach ($items as $item) {
if ($item->hasExtension(HasGridListFilters::class_name())) {
if ($itemFilters = $item->{HasGridListFilters::relationship_name()}()->column('ID')) {
if (in_array($filterID, $itemFilters)) {
$found = true;
break;
}
}
}
}
}
foreach ($filters as $filter) {
if (isset($foundFilters[$filter->ID])) {
$out->push($filter);
}
}
$filters = $out;
}
}
}