# 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:

```php
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);
    }
}
```

<p class="callout info">The formatter also assigns the context built by the `ListingRulesContextBuilder` as view data to the rule.</p>

---

### Parameters

<table border="1" id="bkmrk-parameter-type-descr" style="border-collapse: collapse; width: 100%; height: 106.188px;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Parameter**</td><td style="height: 29.7969px;">**Type**</td><td style="height: 29.7969px;">**Description**</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">`$pipeline`</td><td style="height: 46.5938px;">`\Aero\Admin\Pipelines\ListingRulesDataFormatter`</td><td style="height: 46.5938px;">The listing rules data formatter.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`$next`</td><td style="height: 29.7969px;">`\Closure`</td><td style="height: 29.7969px;">The next step in the formatter.</td></tr></tbody></table>

### Attributes

<table border="1" id="bkmrk-attribute-type-descr" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col><col style="width: 33.3333%;"></col></colgroup><tbody><tr><td>**Attribute**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`$rule`  
</td><td>`\Aero\Catalog\Models\ListingRule`</td><td>The listing rule being formatted.</td></tr><tr><td>`$data`  
</td><td>`array`  
</td><td>The array of formatted data for the Admin UI.</td></tr></tbody></table>