You are here

public static function LocalizeFields::context in Localize Fields 7

Get translation context.

Utility method, normally not be needed.

Parameters

string $bundle: Empty if field base property, like allowed_values.

string $field_name:

string $property:

Return value

string Empty if non-contextual module setting.

File

./LocalizeFields.inc, line 293
Drupal Localize Fields module

Class

LocalizeFields
@file Drupal Localize Fields module

Code

public static function context($bundle, $field_name, $property) {
  if (self::$localize == -1) {

    // Save a method call if possible.
    self::localize();
  }
  if (self::$useContext) {
    $cntxtDelim = self::CONTEXT_DELIMITER;

    // Check for field base properties (allowed_values) to rule out stupid
    // errors.
    if (!$bundle || $property == 'allowed_values') {
      return 'field' . $cntxtDelim . $field_name . $cntxtDelim . $property;
    }
    return 'field_instance' . $cntxtDelim . $bundle . self::CONTEXT_DELIMITER_BUNDLE . $field_name . $cntxtDelim . $property;
  }
  return '';
}