Closed chillu closed 6 years ago
Related: https://github.com/silverstripe/silverstripe-subsites/issues/296
At a slightly higher level, this also applies to any DataObject that would or could be used by the React form schema. User modifications to a getCMSFields() method that is rendered normally in the CMS via PHP would not be reflected in React form schema examples. This would be an issue for anyone who wanted to develop some module like a "React ModelAdmin" or something.
This is what the original reporter needed to do to get it working. Since it's not exactly trivial, it should be in the docs.
## app.yml
SilverStripe\Assets\File:
extensions:
- QI\Homes\Extensions\HomeFileExtension
SilverStripe\AssetAdmin\Forms\FileFormFactory:
extensions:
- QI\Homes\Extensions\HomeAssetFormFactoryExtension
## HomeFileExtension.php
<?php
namespace QI\Homes\Extensions;
use SilverStripe\ORM\DataExtension;
class HomeFileExtension extends DataExtension
{
private static $db = [
'Description' => 'Text',
];
}
## HomeAssetFormFactoryExtension.php
<?php
namespace QI\Homes\Extensions;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextareaField;
class HomeAssetFormFactoryExtension extends Extension
{
public function updateFormFields(FieldList $fields, $controller, $formName, $context)
{
$fields->insertAfter(
'Title',
TextareaField::create('Description', 'Description')
);
}
}
File->getCMSFields()
can no longer be extended, you needFileFormFactory->updateFormFields()
. Describe this change please:File->getCMSFields()
PHPDocPull Requests