field_access

  1. drupal
    1. drupal7
Versionen
drupal7 field_access($op, $field, $account = NULL)

Determine whether the user has access to a given field.

Übergabeparameter

$op The operation to be performed. Possible values:

  • "edit"
  • "view"

$field The field on which the operation is to be performed.

$account (optional) The account to check, if not given use currently logged in user.

Rückgabewert

TRUE if the operation is allowed; FALSE if the operation is denied.

Verwandte Themen

▾ 3 functions call field_access()

field_default_form in modules/field/field.form.inc
Create a separate form element for each field.
field_default_view in modules/field/field.default.inc
The 'view' operation constructs the $object in a way that you can use drupal_render() to display the formatted output for an individual field. i.e. print drupal_render($object->content['field_foo']);
field_format in modules/field/field.module
Format a field item for display.

Code

modules/field/field.module, line 518

<?php
function field_access($op, $field, $account = NULL) {
  global $user;

  if (is_null($account)) {
    $account = $user;
  }

  $field_access = module_invoke_all('field_access', $op, $field, $account);
  foreach ($field_access as $value) {
    if ($value === FALSE) {
      return FALSE;
    }
  }
  return TRUE;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen