Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created February 26, 2013 11:46
Show Gist options
  • Save amitaibu/5037917 to your computer and use it in GitHub Desktop.
Save amitaibu/5037917 to your computer and use it in GitHub Desktop.
/**
* Profile task; Attach OG related fields.
*/
function kaveret_og_setup() {
// Group type.
og_create_field(OG_GROUP_FIELD, 'node', 'project');
og_create_field(OG_ACCESS_FIELD, 'node', 'project');
// Group content type
$bundles = array(
'foo',
'bar',
);
$og_field = og_fields_info(OG_AUDIENCE_FIELD);
$og_field['instance']['label'] = 'Project';
$og_field['field']['settings']['handler_settings']['target_bundles'] = array('project');
foreach ($bundles as $bundle) {
og_create_field('og_project', 'node', $bundle, $og_field);
}
og_create_field(OG_GROUP_FIELD, 'node', 'campain');
og_create_field(OG_ACCESS_FIELD, 'node', 'campain');
// Group content type
$bundles = array(
'offer',
'request',
);
$og_field['instance']['label'] = 'Campain';
$og_field['field']['settings']['handler_settings']['target_bundles'] = array('campain');
foreach ($bundles as $bundle) {
og_create_field('og_campain', 'node', $bundle, $og_field);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment