Msieprawski\ResourceTable\Generators\Collection::filter PHP Method

filter() public method

Sets true if filter should be rendered
public filter ( boolean $enabled )
$enabled boolean
    public function filter($enabled)
    {
        if (!is_bool($enabled)) {
            throw new CollectionException('Filter must be enabled or disabled. Bool is required.');
        }
        $this->_filter = $enabled;
        return $this;
    }

Usage Example

 /**
  * Sets custom configuration (if set) on given Collection
  *
  * @param Collection $collection
  * @return Collection
  */
 private static function _addCustomAttributes(Collection $collection)
 {
     if (self::$_customPaginationPresenter) {
         $collection->setPaginationPresenter(self::$_customPaginationPresenter);
     }
     if (self::$_customView) {
         $collection->view(self::$_customView);
     }
     if (self::$_customCustomView) {
         $collection->customView(self::$_customCustomView);
     }
     if (self::$_customPaginate) {
         $collection->paginate(self::$_customPaginate);
     }
     if (self::$_customPerPage) {
         $collection->perPage(self::$_customPerPage);
     }
     if (self::$_customPage) {
         $collection->page(self::$_customPage);
     }
     if (self::$_customFilter) {
         $collection->filter(self::$_customFilter);
     }
     if (self::$_rendererNamespace) {
         $collection->setRendererNamespace(self::$_rendererNamespace);
     }
     return $collection;
 }