View source
<?php
function commerce_pricelist_on_users_install() {
$field = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'user_commerce_pricelists',
'foreign keys' => array(
'commerce_pricelist_list' => array(
'columns' => array(
'entity_id' => 'list_id',
),
'table' => 'commerce_pricelist_list',
),
),
'indexes' => array(
'target_id' => array(
0 => 'target_id',
),
),
'locked' => 0,
'module' => 'entityreference',
'settings' => array(
'handler' => 'base',
'handler_settings' => array(
'behaviors' => array(
'field_default_token' => array(
'status' => TRUE,
),
'views-select-list' => array(
'status' => 0,
),
),
'sort' => array(
'type' => 'none',
),
'target_bundles' => array(),
),
'target_type' => 'commerce_pricelist_list',
),
'translatable' => 0,
'type' => 'entityreference',
);
field_create_field($field);
$instance = array(
'bundle' => 'user',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'user',
'field_name' => 'user_commerce_pricelists',
'label' => 'User Commerce Pricelists',
'required' => 0,
'settings' => array(
'user_register_form' => 0,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => -20,
),
);
field_create_instance($instance);
}
function commerce_pricelist_on_users_enable() {
cache_clear_all('hook_info', 'cache_bootstrap');
}
function commerce_pricelist_on_users_update_7001(&$sandbox) {
$field = array(
'field_name' => 'user_commerce_pricelists',
'foreign keys' => array(
'commerce_pricelist_list' => array(
'columns' => array(
'entity_id' => 'list_id',
),
),
),
);
field_update_field($field);
}