A critical vulnerability was discovered in React Server Components (Next.js). Our Systems Remain Fully Protected. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our Systems Remain Fully Protected. Learn More.
All shared blocks will implement the IContent interface at runtime.
Local blocks won't.
If you call CmsBlockName on a local block, you'll get null reference exception.
I would suggest this code instead:
public static class BlockHelpers
{
public static string GetName(this BlockData block)
{
var content = block as IContent;
return content?.Name;
}
}
Hi all,
Why does this works ?
I looked everywhere and none of the ancestors of MyBlock implements IContent. So why am I able to get the name on the content block by doing this ?