Piwik\DataTable::queueFilter PHP Метод

queueFilter() публичный Метод

Filters that prettify the column values or don't need the full set of rows should be queued. This way they will be run after the table is truncated which will result in better performance.
public queueFilter ( string | Closur\Closure $className, array $parameters = [] )
$className string | Closur\Closure The class name of the filter, eg. `'Limit'`.
$parameters array The parameters to give to the filter, eg. `array($offset, $limit)` for the Limit filter.
    public function queueFilter($className, $parameters = array())
    {
        if (!is_array($parameters)) {
            $parameters = array($parameters);
        }
        $this->queuedFilters[] = array('className' => $className, 'parameters' => $parameters);
    }

Usage Example

Пример #1
0
 /**
  * @param DataTable $table
  */
 public function filter($table)
 {
     // the htmlspecialchars_decode call is for BC for before 1.1
     // as the Referrer URL was previously encoded in the log tables, but is now recorded raw
     $table->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', function ($label) {
         return htmlspecialchars_decode($label);
     }));
     $table->queueFilter('ColumnCallbackReplace', array('label', 'Piwik\\Plugins\\Referrers\\getPathFromUrl'));
     foreach ($table->getRowsWithoutSummaryRow() as $row) {
         $subtable = $row->getSubtable();
         if ($subtable) {
             $this->filter($subtable);
         }
     }
 }
All Usage Examples Of Piwik\DataTable::queueFilter