Field::isUse($usetype[,$usetype...])

Version 3.8

Check if field implements given use

Return TRUE if field is implements one of the given use.

Return value

Bool

Arguments

$usetype
Usetype name: date, time, datetime, amount, contact, location, reference.
Comma delimited list or array of strings

Full documentation

Show all contact information:

foreach ( $Customer->getFields() as $Field ){
    if ( $Field->isUse('contact') ){
        $txt .= "{$Field->getTitle()}: {$Field->getValue()}";
    }
}

Note: Previous example could also be made using Page::getFieldsByUse() method:

foreach ( $Customer->getFieldsByUse('contact') as $Field ){
    $txt .= "{$Field->getTitle()}: {$Field->getValue()}";
}