Source of file DraftOnlyFilter.php
Size: 1,479 Bytes - Last Modified: 2021-12-23T10:36:58+00:00
/var/www/docs.ssmods.com/process/src/src/Filters/DraftOnlyFilter.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | <?php /** * This file is part of SilverWare. * * PHP version >=5.6.0 * * For full copyright and license information, please view the * LICENSE.md file that was distributed with this source code. * * @package SilverWare\ModelFilters\Filters * @author Colin Tucker <colin@praxis.net.au> * @copyright 2017 Praxis Interactive * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * @link https://github.com/praxisnetau/silverware-model-filters */ namespace SilverWare\ModelFilters\Filters; use SilverWare\ModelFilters\Model\Filter; /** * A filter implementation that shows only draft records. * * @package SilverWare\ModelFilters\Filters * @author Colin Tucker <colin@praxis.net.au> * @copyright 2017 Praxis Interactive * @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause * @link https://github.com/praxisnetau/silverware-model-filters */ class DraftOnlyFilter extends Filter { /** * Answers the title of the filter. * * @return string */ public function getTitle() { return _t(__CLASS__ . '.DRAFTRECORDS', 'Draft records'); } /** * Applies the filter to the data list and answers the result. * * @return DataList */ public function apply() { $records = $this->getDraftRecords(); if ($ids = $this->getLiveIds()) { $records = $records->exclude('ID', $ids); } return $records; } } |