function RulesI18nStringObjectWrapper::buildElementProperties

Adds in translatable properties of the given element.

1 call to RulesI18nStringObjectWrapper::buildElementProperties()
RulesI18nStringObjectWrapper::build_properties in rules_i18n/rules_i18n.i18n.inc
Get translatable properties.

File

rules_i18n/rules_i18n.i18n.inc, line 72

Class

RulesI18nStringObjectWrapper
Custom I18nString object wrapper; registers custom properties per config.

Code

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],
                );
            }
        }
    }
}