Difference between revisions of "Core/getFieldById"
From PunchCMS
(New page: __NOTOC__ ==== PCMS_Client->getFieldById(fieldId) ==== === Overview === Get a field with a specific id from the CMS. This is usually used to transfer the id of File and Image field types t...) |
(→Returns) |
||
Line 8: | Line 8: | ||
=== Returns === | === Returns === | ||
If a field is found matching the id this method returns a valid Field object. Otherwise NULL. | If a field is found matching the id this method returns a valid Field object. Otherwise NULL. | ||
− | That way you can test if you get a valid return using the [http://www.php.net/manual/en/function.is-object.php | + | That way you can test if you get a valid return using the [http://www.php.net/manual/en/function.is-object.php is_object()] method. |
+ | |||
=== Example === | === Example === | ||
<source lang="php"> | <source lang="php"> |
Latest revision as of 17:15, 25 December 2008
PCMS_Client->getFieldById(fieldId)
Overview
Get a field with a specific id from the CMS. This is usually used to transfer the id of File and Image field types to external scripts.
Arguments
fieldId [integer]
Id of the field you are looking for.
Returns
If a field is found matching the id this method returns a valid Field object. Otherwise NULL. That way you can test if you get a valid return using the is_object() method.
Example
$objCms = PCMS_Client::getInstance(); $objField = $objCms->getFieldById(33442); if (is_object($objField)) { // Found Field with id 33442. }