Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I've built an entity that declares a fieldable type of true, and yet when I go to a defined administration page to add a new entry, I cannot find any links pointing to the field creation prompts. I'm confused, as all of the documentation I've referenced for the Entity API leads me to believe that this functionality is exposed once fieldable is enabled. Does the ability to add fields require the use of a bundle to expose these settings? Do I have something misconfigured in my hook_entity_info?

/**
 * Implements hook_entity_info()
 */
function card_recipient_entity_info() {
    $return['card_recipient'] = array(
        'label' => t('Card Recipient'),
        'entity class' => 'Entity',
        'controller class' => 'EntityAPIController',
        'fieldable' => TRUE,
        'base table' => 'card_recipient',
        'uri callback' => 'entity_class_uri',
        'label callback' => 'entity_class_label',
        'entity keys' => array(
            'id' => 'cid',
            'label' => 'title',
        ),
        'access callback' => 'card_recipient_access',
        'module' => 'card_recipient',
        'view modes' => array(
            'full' => array(
                'label' => t('Full Content'),
                'custom settings' => FALSE
            ),
        ),
        'admin ui' => array(
            'path' => 'admin/structure/card_recipients',
        //'controller class' => 'EntityAPIController',
        ),
    );

    return $return;
}

/**
 * Implements hook_schema
 **/
function card_recipient_schema() {
    $schema['card_recipient'] = array(
        "description" => "The base table for card recipients",
        "fields" => array(
            'cid' => array(
                'type' => 'serial',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ),
            'vid' => array(
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => FALSE,
                'default' => NULL,
            ),
            'title' => array(
                'description' => 'Title',
                'type' => 'varchar',
                'not null' => TRUE,
                'default' => 'New Card Title',
                'length' => 255,
            ),
            'fname' => array(
                'type' => 'varchar',
                'not null' => TRUE,
                'default' => "First Name",
                'length' => 255
            ),
            'lname' => array(
                'type' => 'varchar',
                'not null' => TRUE,
                'default' => 'Last Name',
                'length' => 255,
            ),
            'company_name' => array(
                'type' => 'text',
                'not null' => FALSE,
            ),
            'mail_address' => array(
                'type' => 'text',
                'not null' => FALSE,
            ),
            'compid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'unsigned' => TRUE,
                'default' => 0,
            ),
            'comprepid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'unsigned' => TRUE,
                'default' => 0
            ),
            'compadminid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'unsigned' => TRUE,
                'default' => 0
            ),
            'status' => array(
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
            ),
            'created' => array(
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
            ),
            'changed' => array(
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
            )
        ),
        'primary key' => array('cid'),
        'unique keys' => array(
            'name' => array('title'),
        ),
    );

    return $schema;
}

Other source code notes:

  • Currently the schema for this module (see above) lacks a Bundle definition, but can be added
  • Additional source code can be posted at request, although outside of a access callback, some permissions, and a Admin UI form that abides by the rules outlined here, there's nothing significant to see.
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.