/** * Record difference between two objects, if any. * Pass in the name to use in the message and the two options. You can also specify your own text to use when * one of the objects is not set. * @param string $name * @param NAMED_OBJECT $orig The original object. * @param NAMED_OBJECT $new The new object. * @param string $empty_text Text to use when object is not set. * @param string $prefix Show this after each object's title. * @param string $suffix * @access private */ protected function _record_object_difference($name, $orig, $new, $empty_text = '[not set]', $prefix = '', $suffix = '') { if (isset($orig)) { $t = $orig->title_formatter(); $t->max_visible_output_chars = 0; $orig_title = $prefix . $orig->title_as_plain_text($t) . $suffix; } else { $orig_title = $empty_text; } if (isset($new)) { $t = $new->title_formatter(); $t->max_visible_output_chars = 0; $new_title = $prefix . $new->title_as_plain_text($t) . $suffix; } else { $new_title = $empty_text; } $this->_record_string_difference($name, $orig_title, $new_title); }
/** * Add this object's (unlinked) name to the location. * @param NAMED_OBJECT $obj * @param string $icon The optional icon to include with the object's menu item. */ public function add_object_text($obj, $icon = '') { $t = $obj->title_formatter(); $t->max_visible_output_chars = 0; $this->append($obj->title_as_html($t), '', $icon); }