public static function PartyPrimaryFields::getSourcesByType in Party 7
Get hold of primary field sources by type.
Parameters
string|array $types: Either a single type or an array of types we want suitable sources for.
bool $all_types: Indicate whether you want to check against the 'all types' key which includes callback types Defaults to TRUE.
Return value
array An array of source information filtered by type. See PartyPrimaryFields::$sources for the data structure.
1 call to PartyPrimaryFields::getSourcesByType()
- PartyPrimaryFields::sourceForm in includes/
party.primary_fields.inc - Set up a source form under the given element.
File
- includes/
party.primary_fields.inc, line 204 - Primary field related functions and callbacks.
Class
- PartyPrimaryFields
- Helper class for primary fields.
Code
public static function getSourcesByType($types, $all_types = TRUE) {
// Get our full list of sources.
$sources = self::getSources();
// Loop over our sources and remove items we don't want.
foreach ($sources as &$data_set) {
foreach ($data_set['sources'] as $key => $info) {
if (!self::sourceTypeMatch($types, $info, $all_types)) {
unset($data_set['sources'][$key]);
}
}
}
// Run our cleanup.
self::cleanSources($sources);
return $sources;
}