[Resolved] How to get the Block Field Definitions?

Hi All,

I tried to get field definitions of block type but it is retuning the layout definitions also. How to get only field definition for block ?

The code which i tried to get field definitions

$blockObject = $object->getBlockName();
$blockDefinitions=$blockObject->getChilds();

This post was flagged by the community and is temporarily hidden.

Thanks, I found the answer and would like to share with you.

$ObjectFfieldDefintions = $object->getClass()->getFieldDefinitions();
$blockDefintion=$ObjectFieldDefintions['blockName'];
$blockFieldDefinitions= $blockDefintion->getFieldDefinitions();

Don’t use getChilds() to get definitions unless if you need to get the layout definitions.

Thanks,
Karthikeyan Balusamy.

1 Like