Dear all,
I just create a custom entity in Drupal 7. I would like to make it work with entity translation as I plan to use in multilingual website.
The custom entity seem working find with Drupal field API and any entity operations (CRUD operation). I tried to enable Entity Translation, the "Translate" tab is displayed and also can see translation overview page. When I click to add translate, it saved the data (it mean when visiting page with certain language, it display correctly with current data language), but when I go to translate overview page again, it still have no translated. How come? Help please......
Please see the image below:
Before and after translated, this page still the same.
The original source:
Translated:
- Here is my table schema:
$schema = array(
'description' => 'Stores identity information of users.',
'fields' => array(
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'disp-width' => '11',
),
'name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
'language' => array(
'type' => 'varchar',
'length' => 32,
'not null' => FALSE,
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'disp-width' => '11',
'default' => 0,
),
'changed' => array(
'type' => 'int',
'not null' => TRUE,
'disp-width' => '11',
'default' => 0,
),
'updater_uid' => array(
'type' => 'int',
'not null' => TRUE,
'disp-width' => '11',
'default' => 0,
)
),
'primary key' => array('uid'),
);
- hook_entity_info:
function identity_entity_info() {
$return['identity'] = array(
'label' => t('Identity'),
'entity class' => 'Identity',
'plural label' => t('Identities'),
'base table' => 'identity',
'revision table' => 'identity_revision',
'description' => t('Identity information of users.'),
'controller class' => 'EntityIdentityController',
'fieldable' => TRUE,
'exportable' => FALSE,
'entity keys' => array(
'id' => 'uid',
'label' => 'name',
'translations' => 'translations'
),
'bundles' => array(
'identity' => array(
'label' => t('Identity'),
'admin' => array(
'path' => 'admin/structure/identity/manage/identity',
'real path' => 'admin/structure/identity/manage/identity',
),
),
),
'view modes' => array(
'full' => array(
'label' => t('User account'),
'custom settings' => FALSE,
),
),
'admin ui' => array(
'path' => 'admin/structure/identity',
'controller class' => 'IdentityUIController',
),
'access callback' => 'identity_access',
'module' => 'identity',
'translation' => array(
'locale' => TRUE,
'entity_translation' => array(
'class' => 'EntityTranslationDefaultHandler',
'default settings' => array(
'default_language' => LANGUAGE_NONE,
'hide_language_selector' => FALSE,
),
'base path' => 'identity/%identity',
'path wildcard' => '%identity',
'access callback' => 'identity_entity_translation_tab_access'
),
),
);
return $return;
}
Really appreciate for your help!
Comment | File | Size | Author |
---|---|---|---|
#2 | 2-Translated.PNG | 34.87 KB | kriyar |
2-Orignal.PNG | 22.96 KB | kriyar | |
no_translate.PNG | 12.98 KB | kriyar |
Comments
Comment #2
kriyar CreditAttribution: kriyar commentedComment #3
kriyar CreditAttribution: kriyar commentedComment #4
stefanos.petrakis@gmail.comHey there,
Let's have a look at this together.
Here is a first question:
Do you get new entries for your new 'identity' entities in the tables 'entity_translation' and 'entity_translation_revision'?
Comment #5
plachComment #6
kriyar CreditAttribution: kriyar commentedHi Stefanous,
Yes, I saw the new entries in the table 'entity_translation', but did not see in the table 'entity_translation_revision'.
So how?
Comment #7
kriyar CreditAttribution: kriyar commentedComment #8
plachThis may be related to the BC killswitch we introduced to add revision support without breaking old sites: check whether the
entity_translation_revision_enabled
variable evaluates to true.Another possibility could be that your entity type does not define a
revision
entity key, see:http://cgit.drupalcode.org/entity_translation/tree/includes/translation....
To fix that you could either define the
revision
entity key in the entity info or extend the translation handler class and initialize the$revisionable
property toTRUE
.Comment #9
kriyar CreditAttribution: kriyar commentedI debug the vairiable entity_translation_revision_enabled, it return TRUE.
Any other suggestion?
Comment #10
plachWhat about the second part of my comment above?
Comment #11
kriyar CreditAttribution: kriyar commentedComment #12
ciss CreditAttribution: ciss at yousign GmbH commented