What is the listing rules data formatter pipeline?
The Listing Rules Data Formatter is used to format the listing rules data into an array for the Admin UI page.
For example, the \Aero\Admin\Pipelines\Pipes\AttachListingRuleAttributes attaches the attributes to the array:
class AttachListingRuleAttributes
{
public function handle(\Aero\Admin\Pipelines\ListingRulesDataFormatter $pipeline, Closure $next)
{
$pipeline->data['id'] = $pipeline->rule->getKey();
$pipeline->data['type'] = $pipeline->rule->getAttribute('type');
$pipeline->data['rule_logic'] = $pipeline->rule->getAttribute('rule_logic') ?? 'must';
$pipeline->data['logic'] = $pipeline->rule->getAttribute('logic') ?? 'and';
$pipeline->data['group'] = $pipeline->rule->getAttribute('group') ?? 0;
$pipeline->data['options'] = $pipeline->rule->getAttribute('options') ?? [];
return $next($pipeline);
}
}
The formatter also assigns the context built by the ListingRulesContextBuilder as view data to the rule.
Parameters
| Parameter | Type | Description |
$pipeline |
\Aero\Admin\Pipelines\ListingRulesDataFormatter |
The listing rules data formatter. |
$next |
\Closure |
The next step in the formatter. |
Attributes
| Attribute |
Type |
Description |
$rule |
\Aero\Catalog\Models\ListingRule |
The listing rule being formatted. |
$data |
array |
The array of formatted data for the Admin UI. |