Hi Folks,
I don't know if this is a bug or a feature request ... anyway ...
I needed only the fields of a specific content type so , I call content_fields(NULL,'MyContentType'), but I get ALL the field of my drupal site ... not what I expected.
See the issue here about filefield paths module: http://drupal.org/node/606500
By modifiying the function content_fields this way:
function content_fields($field_name = NULL, $content_type_name = NULL) {
$info = _content_type_info();
if (isset($info['fields'])) {
if (empty($field_name)) {
if (!empty($content_type_name)) {
// remove all the field in $info['fields'] not specific to this content_type_name - content_type_name MUST be in lower case
foreach ($info['fields'] as $field ) {
if ($field['type_name']!=$content_type_name) {
unset($info['fields'][ $field['field_name'] ]);
}
}
}
return $info['fields'];
}
if (isset($info['fields'][$field_name])) {
if (empty($content_type_name)) {
return $info['fields'][$field_name];
}
if (isset($info['content types'][$content_type_name]['fields'][$field_name])) {
return $info['content types'][$content_type_name]['fields'][$field_name];
}
}
}
}
only the fields specifics to this content_type_name will be return.
Hope this help ....
Regards
PS: and thx for all your hard work at this module and cck in core what an achievement (or a begining !!!)
Comments
Comment #1
markus_petrux commentedUse content_types() instead. Example:
Comment #2
nico059 commentedThx markus, it works No 1.
Comment #3
oskar_calvo commentedMaybe if the someone update the documentation will be great http://drupalcontrib.org/api/drupal/contributions--cck--content.module/f... .
thanks.
Oskar