function field_available_languages

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 field.multilingual.inc field_available_languages($entity_type, $field)
cle7 field.multilingual.inc field_available_languages($entity_type, $field)
elmsmedia7 field.multilingual.inc field_available_languages($entity_type, $field)
icor7 field.multilingual.inc field_available_languages($entity_type, $field)
meedjum_blog7 field.multilingual.inc field_available_languages($entity_type, $field)
mooc7 field.multilingual.inc field_available_languages($entity_type, $field)

Collects the available languages for the given entity type and field.

If the given field has language support enabled, an array of available languages will be returned, otherwise only LANGUAGE_NONE will be returned. Since the default value for a 'translatable' entity property is FALSE, we ensure that only entities that are able to handle translations actually get translatable fields.

Parameters

$entity_type: The type of the entity the field is attached to, e.g. 'node' or 'user'.

$field: A field structure.

Return value

An array of valid language codes.

Related topics

14 calls to field_available_languages()
ctools_field_invoke_field in sites/all/modules/ulmus/ctools/includes/fields.inc
Replacement for core _field_invoke() to invoke on a single field.
EntityReferenceBehavior_TaxonomyIndex::buildNodeIndex in sites/all/modules/ulmus/entityreference/plugins/behavior/EntityReferenceBehavior_TaxonomyIndex.class.php
Builds and inserts taxonomy index entries for a given node.
field_collection_item_is_empty in sites/all/modules/ulmus/field_collection/field_collection.module
Determines whether a field collection item entity is empty based on the collection-fields.
field_sql_storage_field_storage_load in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_load().
field_sql_storage_field_storage_write in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_write().

... See full list

1 string reference to 'field_available_languages'
field_info_cache_clear in modules/field/field.info.inc
Clears the field info cache without clearing the field data cache.

File

modules/field/field.multilingual.inc, line 89
Functions implementing Field API multilingual support.

Code

function field_available_languages($entity_type, $field) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['field_languages'] = &drupal_static(__FUNCTION__);
  }
  $field_languages = &$drupal_static_fast['field_languages'];
  $field_name = $field['field_name'];

  if (!isset($field_languages[$entity_type][$field_name])) {
    // If the field has language support enabled we retrieve an (alterable) list
    // of enabled languages, otherwise we return just LANGUAGE_NONE.
    if (field_is_translatable($entity_type, $field)) {
      $languages = field_content_languages();
      // Let other modules alter the available languages.
      $context = array(
        'entity_type' => $entity_type,
        'field' => $field,
      );
      drupal_alter('field_available_languages', $languages, $context);
      $field_languages[$entity_type][$field_name] = $languages;
    }
    else {
      $field_languages[$entity_type][$field_name] = array(LANGUAGE_NONE);
    }
  }

  return $field_languages[$entity_type][$field_name];
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.