function pre_render($values) { $this->orig_alias = $this->options['id']; } function advanced_render($values) { $this->last_render = $value = $this->render($values); $this->original_value = $value; $field = $this->orig_alias; if ($this->options['type'] == 'separator') { $separator = check_plain($this->options['separator']); } if ($this->allow_advanced_render()) { $tokens = NULL; if (!empty($this->options['alter']['alter_text']) && !empty($this->options['alter']['text'])) { $tokens = $this->get_render_tokens(); if (isset($separator)) { $data = explode($separator, $value); } foreach ($data as $key => $item) { $tokens['['. $field .']'] = $item; $data[$key] = $this->render_altered($tokens); } } if (!empty($this->options['alter']['trim']) && !empty($this->options['alter']['max_length'])) { $value = $this->render_trim_text($value); } if (!empty($this->options['alter']['make_link']) && !empty($this->options['alter']['path'])) { if (!isset($tokens)) { $tokens = $this->get_render_tokens(); } if (isset($separator)) { $data = explode($separator, $value); } foreach ($data as $key => $item) { $tokens['['. $field .']'] = $item; $data[$key] = $this->render_as_link($item, $tokens); } } if (isset($separator)) { $value = implode($separator, $data); } // This happens here so that render_as_link can get the unaltered value of // this field as a token rather than the altered value. $this->last_render = $value; } return $this->last_render; }