/** * Provides editable columns for the extended models related StreakRegionalShipping_Shippable models. * * @param array $fieldSpecs * @return bool */ public function provideEditableColumns(array &$fieldSpecs) { if (static::ModelClass == $this->owner->class) { $shippingRegions = Region_Shipping::get()->map()->toArray(); $fieldSpecs += array('RegionID' => array('title' => 'Region', 'callback' => function ($record, $col) use($shippingRegions) { $field = new Select2Field('RegionID', '', $shippingRegions, $record ? $record->{$col} : null); $field->setValue($record->{$col}); return $field; }), 'Price' => array('title' => 'Price', 'callback' => function ($record, $col) { return new NumericField($col, $col, $record ? $record->{$col} : null); }), 'ID' => array('title' => '', 'callback' => function ($record, $col) { return new HiddenField('ID', '', $record ? $record->{$col} : null); })); return true; } return false; }