function party_hat_update_7001 in Party 8.2
Same name and namespace in other branches
- 7 modules/party_hat/party_hat.install \party_hat_update_7001()
Drop Party Bundles - migrate hat fields.
File
- modules/
party_hat/ party_hat.install, line 152 - Contains install hooks for the party hat module..
Code
function party_hat_update_7001() {
if (!field_info_instance('party', 'party_hat', 'party')) {
$instance = array(
'field_name' => 'party_hat',
'entity_type' => 'party',
'bundle' => 'party',
'label' => t('Hats'),
'required' => FALSE,
'description' => t("This party's hats"),
'default_value_function' => 'party_hat_field_get_default',
'widget' => array(
'type' => 'options_buttons',
'settings' => array(),
),
'display' => array(
'default' => array(
'type' => 'hat_reference_default',
'label' => 'inline',
),
),
);
field_create_instance($instance);
}
// Update Existing field data
db_update('field_data_party_hat')
->fields(array(
'bundle' => 'party',
))
->execute();
db_update('field_revision_party_hat')
->fields(array(
'bundle' => 'party',
))
->execute();
// Remove old instances
$instance = array(
'field_name' => 'party_hat',
'entity_type' => 'party',
'bundle' => 'organisation',
);
field_delete_instance($instance);
$instance = array(
'field_name' => 'party_hat',
'entity_type' => 'party',
'bundle' => 'individual',
);
field_delete_instance($instance);
}