function brightcove_field_browse_access in Brightcove Video Connect 7.2
Same name and namespace in other branches
- 7.7 brightcove.module \brightcove_field_browse_access()
- 7.3 brightcove_field/brightcove_field.module \brightcove_field_browse_access()
- 7.4 brightcove_field/brightcove_field.module \brightcove_field_browse_access()
- 7.5 brightcove_field/brightcove_field.module \brightcove_field_browse_access()
- 7.6 brightcove.module \brightcove_field_browse_access()
Access callback for brightcove browser.
1 string reference to 'brightcove_field_browse_access'
- brightcove_field_menu in brightcove_field/
brightcove_field.module - Implementation of hook_menu().
File
- brightcove_field/
brightcove_field.module, line 103 - Brightcove field module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.
Code
function brightcove_field_browse_access($entity_type, $field_name, $entity_id_or_bundle = NULL) {
$field = field_info_field($field_name);
if ($entity_id_or_bundle) {
if (is_numeric($entity_id_or_bundle)) {
// entity id is given
$entity = entity_load($entity_type, array(
$entity_id_or_bundle,
));
if (count($entity)) {
$entity = array_shift($entity);
return entity_access('update', $entity_type, $entity) && field_access('edit', $field, $entity_type);
}
}
else {
// bundle is given
return entity_access('create', $entity_type, $entity_id_or_bundle) && field_access('edit', $field, $entity_type);
}
}
return entity_access('create', $entity_type) && field_access('edit', $field, $entity_type);
}