class MailchimpI18nStringObjectWrapper in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_i18n/mailchimp_i18n.i18n.inc \MailchimpI18nStringObjectWrapper
Custom I18n String object wrapper.
Register custom properties per Mailchimp signup entity.
Hierarchy
- class \i18n_object_wrapper
Expanded class hierarchy of MailchimpI18nStringObjectWrapper
1 string reference to 'MailchimpI18nStringObjectWrapper'
- MailchimpI18nStringController::hook_object_info in modules/mailchimp_i18n/ mailchimp_i18n.i18n.inc 
- Overridden to customize i18n object info.
File
- modules/mailchimp_i18n/ mailchimp_i18n.i18n.inc, line 31 
- i18n_string integration based upon the Entity API i18n.
View source
class MailchimpI18nStringObjectWrapper extends i18n_string_object_wrapper {
  /**
   * Get translatable properties.
   */
  protected function build_properties() {
    $strings = parent::build_properties();
    $properties = array();
    $title_mapping = array(
      'description' => t('Description'),
      'submit_button' => t('Submit Button Label'),
      'confirmation_message' => t('Confirmation Message'),
    );
    // Add in translations for all settings and mergefields.
    foreach ($this->object->settings as $settings_key => $setting) {
      if (is_array($setting)) {
        $mergefields = array_filter($setting);
        foreach ($mergefields as $tag => $mergefield_settings) {
          $properties['mergefield:' . $tag] = array(
            'title' => $mergefield_settings->name,
            'string' => $mergefield_settings->name,
          );
        }
      }
      if (isset($title_mapping[$settings_key])) {
        $properties[$settings_key] = array(
          'title' => $title_mapping[$settings_key],
          'string' => $setting,
        );
      }
    }
    if (!isset($strings[$this
      ->get_textgroup()]['mailchimp_signup'][$this->object->name])) {
      $strings[$this
        ->get_textgroup()]['mailchimp_signup'][$this->object->name] = array();
    }
    if (!empty($this->object->settings['include_interest_groups'])) {
      $lists = mailchimp_get_lists($this->object->mc_lists);
      if (!empty($lists)) {
        foreach ($lists as $list) {
          foreach ($list->intgroups as $intgroup) {
            $properties['intgroup_' . $intgroup->id] = array(
              'title' => $intgroup->title,
              'string' => $intgroup->title,
            );
            if (!empty($intgroup->interests)) {
              foreach ($intgroup->interests as $interest) {
                $properties['intgroup_' . $intgroup->id . '_interest_' . $interest->id] = array(
                  'title' => $interest->name,
                  'string' => $interest->name,
                );
              }
            }
          }
        }
      }
    }
    $strings[$this
      ->get_textgroup()]['mailchimp_signup'][$this->object->name] += $properties;
    return $strings;
  }
}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. | |
| MailchimpI18nStringObjectWrapper:: | protected | function | Get translatable properties. Overrides i18n_string_object_wrapper:: | 
