function commerce_wishlist_create_visibility_field in Commerce Wishlist 7.3
Create a visibility field.
3 calls to commerce_wishlist_create_visibility_field()
- commerce_wishlist_install in ./
commerce_wishlist.install - Implements hook_install().
- commerce_wishlist_update_7300 in ./
commerce_wishlist.install - Convert wish lists to use orders.
- commerce_wishlist_update_7302 in ./
commerce_wishlist.install - Create visibility field.
File
- ./
commerce_wishlist.install, line 58 - Installation hooks.
Code
function commerce_wishlist_create_visibility_field() {
// Create our visibility field.
if (!field_info_field('commerce_wishlist_visibility')) {
field_create_field(array(
'translatable' => '0',
'entity_types' => array(),
'settings' => array(
'allowed_values' => array(
0 => 'Private',
1 => 'Protected',
2 => 'Public',
),
'allowed_values_function' => '',
),
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'field_name' => 'commerce_wishlist_visibility',
'type' => 'list_integer',
'module' => 'list',
'active' => '1',
'locked' => '0',
'cardinality' => '1',
'columns' => array(
'value' => array(
'type' => 'int',
'not null' => FALSE,
),
),
'bundles' => array(
'commerce_order' => array(
0 => 'commerce_order',
),
),
));
}
if (!field_info_instance('commerce_order', 'commerce_wishlist_visibility', 'commerce_order')) {
field_create_instance(array(
'label' => 'Wishlist visibility',
'widget' => array(
'weight' => '-10',
'type' => 'options_select',
'module' => 'options',
'active' => 1,
'settings' => array(),
),
'settings' => array(
'user_register_form' => FALSE,
),
'display' => array(
'default' => array(
'label' => 'above',
'type' => 'hidden',
'weight' => '-10',
'settings' => array(),
),
),
'required' => 1,
'description' => 'Public means that anyone can see it. Protected wish lists can be shared, but are only available via a special URL. Private wishlists are only accessible to the owner.',
'default_value' => array(
0 => array(
'value' => '0',
),
),
'field_name' => 'commerce_wishlist_visibility',
'entity_type' => 'commerce_order',
'bundle' => 'commerce_order',
));
}
}