Tạo mới field chatroom trong drupal 7

if (!field_info_field(‘field_chatroom’)) {
$field = array(
‘field_name’ => ‘field_chatroom’,
‘type’ => ‘chatroom’,
);
field_create_field($field);

// Create the instance on the bundle.
$instance = array(
‘field_name’ => ‘field_chatroom’,
‘entity_type’ => ‘node’,
‘label’ => ‘ChatRoom’,
‘bundle’ => ‘project’,
‘required’ => TRUE,
‘widget’ => array(
‘type’ => ‘chatroom_chatroom’,
),
);

field_create_instance($instance);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s