silverstripe-framework/docs/en/04_Changelogs/4.3.0.md
2018-10-04 13:29:48 +13:00

1.9 KiB

4.3.0

Overview

  • DataList::column() now returns all values and not just "distinct" values from a column as per the API docs
  • DataList, ArrayList and UnsavedRalationList all have columnUnique() method for fetching distinct column values
  • Take care with stageChildren() overrides. Hierarchy::numChildren() results will only make use of stageChildren() customisations that are applied to the base class and don't include record-specific behaviour.
  • New react-based search UI for the CMS, Asset-Admin, GridFields and ModelAdmins.

Upgrading

Fetching distinct column values on DataList

Prior to this release DataList would erroneously return a distinct list of values from a column on an object. If this behaviour is still required, please use columnUnique() instead.

Using legacy GridField search API

GridFields now default to using the new search UI which uses SilverStripe's FormSchema API.

If you would rather continue using the old search API, you can remove the default GridFieldFilterHeader from your GridField configuration and replace with one whose legacy flag has been enabled.

To enable legacy mod on a GridFieldFilterHeader, just pass true to the first argument of its constructor.

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    // Configure grid field to use legacy search API
    $legacySearchApiFlag = true;
    $config = new GridFieldConfig_RecordEditor();
    $config->removeComponentsByType(GridFieldFilterHeader::class);
    $config->addComponent(new GridFieldFilterHeader($legacySearchApiFlag));
    
    $grid = new GridField('Companies', 'Companies', new DataList(Company::class), $config);
    $fields->addFieldToTab('Root.Compagnu', $grid);
    
    return $fields;
}