Not as programmatic but probably easier to do, and more predictive for the client to use
Interesting — if there’s no actual paragraph it shows the whole content of the page! That’s headings, lists, everything!
ShortDescription field is another workaround, could also display a set number of characters but this could be problematic — client would need to keep a count on Level 2 headings which restricts what they could say and how they say it…
Yes, also clients always manage to do weird things, like copying from word, or a video or image or a list with titles inside or who knows what combination of all those
h2 inside the Content?
I prefer to give them something they will always know how will turn out
That's what unit tests are for....
what is the best way to work out if a DataObject has: (a) write (b) writeToStage('Stage'), (c) publish, etc.... I am just writing a test that goes through all DataObjects to see if they can be written, deleted, etc.. and for Pages, and the like, I also want to test publishing ....
$obj->isVersioned() perhaps and/or $obj->hasStages ??? I can look this up, but I was wondering what would be the most reliable / universal way?
Maybe have a look at SilverStripe\CMS\Model\SiteTree, it does a few checks for stage vs live etc.