web

Maybe have a look at SilverStripe\CMS\Model\SiteTree, it does a few checks for stage vs live etc.

nicolaas

$obj->isVersioned() perhaps and/or $obj->hasStages ??? I can look this up, but I was wondering what would be the most reliable / universal way?

nicolaas

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 ....

Ramon Lapenta

I prefer to give them something they will always know how will turn out

Ramon Lapenta

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

mike_henden

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…

Ramon Lapenta

Not as programmatic but probably easier to do, and more predictive for the client to use

Ramon Lapenta

I’d solve that by adding a ShortDescription field to the items