Reputation: 85
I'm about to extend Silverstripe Module. But I can't figure out what is missing on my simple code.
I need some suggestion to solve what is missing.
namespace {
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
class BlogPostExtension extends DataExtension {
private static $db = [
'Title' => 'Varchar'
];
public function updateCMSFields(FieldList $fields) {
// Add fields here
$fields->addFieldToTab("Root.Gallery", new TextField("Title","Title"));
}
}
}
This what I've added on app.yml. I also doing /dev/build?flush=all. But still nothing works.
SilverStripe\Blog\BlogPost:
extensions:
- Project\Extensions\BlogPostExtension
Upvotes: 1
Views: 245
Reputation: 1499
as wmk pointed out - Title is already part of the fields in the FieldList. If you rename the field to a different name. For example "GalleryTitle" and run dev/build you should have more success.
-- Peter
Upvotes: 1