0

I know how add fields to entity, now what is XXX in below code when I want add this field to comment of articles?

$instance = array(
    'field_name' => 'field_image',
    'entity_type' => 'xxx',
    'bundle' => 'xxx',
    'label' => t('Images'),
    ....

if any other setting is required, then what is that?

1
  • Comments are not entities and as such can't have attached fields – Clive Jan 22 '12 at 20:22
4

I found my answer, see:

dsm(entity_get_info());
dsm(field_info_bundles());

so my code should be:

$instance = array(
    'field_name' => 'field_image',
    'entity_type' => 'comment',
    'bundle' => 'comment_node_article',
    'label' => t('Images'),
    ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.