class RulesI18nStringObjectWrapper in Rules 7.2
Custom I18nString object wrapper; registers custom properties per config.
Hierarchy
- class \i18n_object_wrapper
- class \i18n_string_object_wrapper
- class \RulesI18nStringObjectWrapper
- class \i18n_string_object_wrapper
Expanded class hierarchy of RulesI18nStringObjectWrapper
1 string reference to 'RulesI18nStringObjectWrapper'
- RulesI18nStringController::hook_object_info in rules_i18n/
rules_i18n.i18n.inc - Overridden to customize i18n object info.
File
- rules_i18n/
rules_i18n.i18n.inc, line 43 - Internationalization integration based upon the entity API i18n stuff.
View source
class RulesI18nStringObjectWrapper extends i18n_string_object_wrapper {
/**
* Get translatable properties.
*/
protected function build_properties() {
$strings = parent::build_properties();
$properties = array();
// Also add in the configuration label, as the i18n String UI requires
// a String to be available always.
$properties['label'] = array(
'title' => t('Configuration name'),
'string' => $this->object->label,
);
$this
->buildElementProperties($this->object, $properties);
// Add in translations for all elements.
foreach ($this->object
->elements() as $element) {
$this
->buildElementProperties($element, $properties);
}
$strings[$this
->get_textgroup()]['rules_config'][$this->object->name] = $properties;
return $strings;
}
/**
* Adds in translatable properties of the given element.
*/
protected function buildElementProperties($element, &$properties) {
foreach ($element
->pluginParameterInfo() as $name => $info) {
// Add in all directly provided input variables.
if (!empty($info['translatable']) && isset($element->settings[$name])) {
// If its an array of textual values, translate each value on its own.
if (is_array($element->settings[$name])) {
foreach ($element->settings[$name] as $i => $value) {
$properties[$element
->elementId() . ':' . $name . ':' . $i] = array(
'title' => t('@plugin "@label" (id @id), @parameter, Value @delta', array(
'@plugin' => drupal_ucfirst($element
->plugin()),
'@label' => $element
->label(),
'@id' => $element
->elementId(),
'@parameter' => $info['label'],
'@delta' => $i + 1,
)),
'string' => $value,
);
}
}
else {
$properties[$element
->elementId() . ':' . $name] = array(
'title' => t('@plugin "@label" (id @id), @parameter', array(
'@plugin' => drupal_ucfirst($element
->plugin()),
'@label' => $element
->label(),
'@id' => $element
->elementId(),
'@parameter' => $info['label'],
)),
'string' => $element->settings[$name],
);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
i18n_object_wrapper:: |
protected | property | ||
i18n_object_wrapper:: |
protected | property | ||
i18n_object_wrapper:: |
protected | property | ||
i18n_object_wrapper:: |
protected | property | ||
i18n_object_wrapper:: |
function | Get edit path for object | 2 | |
i18n_object_wrapper:: |
function | Get field value from object/array | ||
i18n_object_wrapper:: |
function | Get string numeric key for indexing. | ||
i18n_object_wrapper:: |
public | function | Get object info | |
i18n_object_wrapper:: |
function | Get key value from object/array | ||
i18n_object_wrapper:: |
public | function | Get language code | |
i18n_object_wrapper:: |
public | function | Get real object or array. | |
i18n_object_wrapper:: |
public | function | Get link for item | 2 |
i18n_object_wrapper:: |
protected | function | Get menu placehoders for object | |
i18n_object_wrapper:: |
public | function | Get object string translation info | |
i18n_object_wrapper:: |
public | function | Get title from item | 2 |
i18n_object_wrapper:: |
function | Menu access callback for mixed translation tab | ||
i18n_object_wrapper:: |
public | function | Get object translation set info | |
i18n_object_wrapper:: |
function | Get translation set id if any | ||
i18n_object_wrapper:: |
public | function | Get object type | |
i18n_object_wrapper:: |
function | Load real object or array. | 1 | |
i18n_object_wrapper:: |
function | Localize object if localizable. | ||
i18n_object_wrapper:: |
protected | function | Replace path with placeholders | |
i18n_object_wrapper:: |
function | Set field value to object/array | ||
i18n_object_wrapper:: |
function | Set translation set id | ||
i18n_object_wrapper:: |
protected | function | Translate access (translation sets) | 2 |
i18n_object_wrapper:: |
public | function | Class constructor | 2 |
i18n_string_object_wrapper:: |
protected | property | ||
i18n_string_object_wrapper:: |
protected | property | ||
i18n_string_object_wrapper:: |
public | function | Get object translatable properties | |
i18n_string_object_wrapper:: |
public | function | Get object strings for translation | |
i18n_string_object_wrapper:: |
public | function | Get string context | 3 |
i18n_string_object_wrapper:: |
public | function | Get textgroup name | |
i18n_string_object_wrapper:: |
protected | function | Context to be pre-loaded before translation. | 2 |
i18n_string_object_wrapper:: |
public | function |
Translation mode for object Overrides i18n_object_wrapper:: |
3 |
i18n_string_object_wrapper:: |
public | function | Get translate path for object | 2 |
i18n_string_object_wrapper:: |
public | function | Load all existing strings for this object. | |
i18n_string_object_wrapper:: |
protected | function |
Translate access (localize strings) Overrides i18n_object_wrapper:: |
|
i18n_string_object_wrapper:: |
public | function | Remove all strings for this object. | |
i18n_string_object_wrapper:: |
public | function | Update all strings for this object. | |
i18n_string_object_wrapper:: |
protected | function | Get textgroup object | |
i18n_string_object_wrapper:: |
public | function |
Translate object. Overrides i18n_object_wrapper:: |
|
i18n_string_object_wrapper:: |
protected | function | Translate object property. | 2 |
i18n_string_object_wrapper:: |
protected | function | Translate all properties for object. | |
RulesI18nStringObjectWrapper:: |
protected | function | Adds in translatable properties of the given element. | |
RulesI18nStringObjectWrapper:: |
protected | function |
Get translatable properties. Overrides i18n_string_object_wrapper:: |