silverstripe-shortcodable
silverstripe-shortcodable copied to clipboard
Does not save to DB when template is empty
Found out a strange reproducable error.
When the template which is used to render the shortcodable dataobject is empty, the shortcode will not be saved to the DB. When I type a simple 'Foo' in the template file, the bug vanishes.
public static function parse_shortcode($attributes, $content, $parser, $shortcode) {
if (isset($attributes['id']) && $map = self::get()->byID($attributes['id'])) {
return $map->customise($data)->renderWith('Map'); // Map.ss cannot be empty
}
}
Isn't that a good start to write a unit test that prooves this wrong behaviour?
I've never written one before.