开发者

Drupal 7: Make custom content translatable

开发者 https://www.devze.com 2023-04-06 14:55 出处:网络
I\'m creating a custom module which enables me to add Countries to a custom table in the database. I\'ll do later more with it, but as I got stuck at the beginning, I can\'t go on.

I'm creating a custom module which enables me to add Countries to a custom table in the database. I'll do later more with it, but as I got stuck at the beginning, I can't go on.

First my piece of code:

function partners_schema()
{
    $schema['partners_country'] = array(
        'description' => 'TODO: please 开发者_开发知识库describe this table!',
        'fields' => array(
            'id' => array(
                'description' => 'auto inc id of country',
                'type' => 'serial',
                'not null' => true,
            ),
            'name' => array(
                'description' => 'name of country',
                'type' => 'varchar',
                'length' => '255',
                'not null' => true,
                'translatable' => true,
            ),
            'needDistributor' => array(
                'description' => 'is a distributor needed',
                'type' => 'int',
                'size' => 'tiny',
                'not null' => true,
            ),
        ),
        'primary key' => array('id'),
    );

    return $schema;
}

The code above generates my Database table. After searching I found that I can add 'translatable' => true to my schema, so Drupal knows that this field is translatable content.

I've added a form, to insert data into that schema, but now I got stuck. What do I have to do, that the user is able to translate the column name?

Thanks for your help.


Have a look at the accepted answer on this post it should help clear a few things up.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号