TRUE); return $options; } /** * Returns an option form for setting this handler's options. */ public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); EntityFieldHandlerHelper::options_form($this, $form, $form_state); $form['format_name'] = array( '#title' => t('Use human-readable name'), '#type' => 'checkbox', '#description' => t("If this is checked, the values' names will be displayed instead of their internal identifiers."), '#default_value' => $this->options['format_name'], '#weight' => -5, ); } public function render($values) { return EntityFieldHandlerHelper::render($this, $values); } /** * Render a single field value. */ public function render_single_value($value, $values) { if (!isset($this->option_list)) { $this->option_list = array(); $callback = $this->definition['options callback']; if (is_callable($callback['function'])) { // If a selector is used, get the name of the selected field. $field_name = EntityFieldHandlerHelper::get_selector_field_name($this->real_field); $this->option_list = call_user_func($callback['function'], $field_name, $callback['info'], 'view'); } } if ($this->options['format_name'] && isset($this->option_list[$value])) { $value = $this->option_list[$value]; } // Sanitization is handled by the wrapper, see // EntityFieldHandlerHelper::get_value(). return $value; } }