Core/getFieldById

From PunchCMS
Revision as of 17:15, 25 December 2008 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 [1] method.

Example

$objCms = PCMS_Client::getInstance();
 
$objField = $objCms->getFieldById(33442);
if (is_object($objField)) {
    // Found Field with id 33442.
}