silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
110 stars 115 forks source link

ENH: Add an extension point on `getReportField` #1153

Closed mikenuguid closed 8 months ago

mikenuguid commented 8 months ago

Description

Add an extension on the getReportField() on both report classes ElementsInUseReport and ElementTypeReport to allow easier updates on gridfield components e.g. implementing GridFieldQueuedExportButton to allow csv export using queuedjob.

Example:

public function getReportField()
{
    Requirements::css('dnadesign/silverstripe-elemental:client/dist/styles/bundle.css');

    /** @var GridField $field */
    $field = parent::getReportField();
    $field->addExtraClass('elemental-report__grid-field');

    $this->extend('updateReportField', $field);

    return $field;
}

Additional context or points of discussion

No response

Validations

GuySartorelli commented 8 months ago

You can get and manipulate the report field using the updateCMSFields extension hook. I don't see that adding an extension hook specifically to getReportField() would be a significant improvement. I'm going to close this issue on that basis.

If you can show that there is a significant improvement by adding extension hooks to getReportField() then we can discuss further.