Gets a list of fields (or columns) for an object by class name.

This includes default values for each field and is used by the objects themselves to build their initial attributes based on class inheritence.


API Docs: http://api.modxcms.com/xpdo/xPDO.html#getFields

array getFields (string $className)


Get a list of fields for the Box object, which has 3 fields: id, width and height:

$fields = $xpdo->getFields('Box');
print_r($fields); // prints: Array ([id] => 1, [width] => 10, [height] => 23)

See Also

Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab) or become an editor of the MODX Documentation.