function field_permission_example_permission

Implements hook_permission().

We want to let site administrators figure out who should be able to view, edit, and administer our field.

Field permission operations can only be view or edit, in the context of one's own content or that of others. Contrast with content types where we also have to worry about who can create or delete content.

Related topics

File

field_permission_example/field_permission_example.module, line 94

Code

function field_permission_example_permission() {
    // Note: This would be very easy to generate programmatically,
    // but it's all typed out here for clarity.
    // The key text is the machine name of the permission.
    $perms['view own fieldnote'] = array(
        'title' => t('View own fieldnote'),
    );
    $perms['edit own fieldnote'] = array(
        'title' => t('Edit own fieldnote'),
    );
    $perms['view any fieldnote'] = array(
        'title' => t('View any fieldnote'),
    );
    $perms['edit any fieldnote'] = array(
        'title' => t('Edit any fieldnote'),
    );
    return $perms;
}