function jeditable_handler_field_node::render in jEditable inline content editing 6.2
Render the field. The inline editor tags are placed innermost.
File
- views/
jeditable_handler_field_node.inc, line 82 - Definition of jeditable_handler_field_node.
Class
- jeditable_handler_field_node
- Extends the views_handler_field_node class.
Code
function render($values) {
$value = parent::render($values);
$is_enabled = $this->options['jeditable']['enabled'];
$reload_page = $this->options['jeditable']['reload_page'];
$hide_if_empty = $this->options['jeditable']['hide_if_empty'];
$disable_if_not_empty = $this->options['jeditable']['disable_if_not_empty'];
$override_defaults = $this->options['jeditable']['override_defaults'];
if (empty($value) && $hide_if_empty) {
return $value;
}
if (!empty($value) && $disable_if_not_empty) {
return $value;
}
if ($is_enabled) {
$field_name = $this->field;
if ($override_defaults) {
$inline_editor_class = "jeditable-{$field_name}";
}
else {
$inline_editor_class = 'jeditable-textfield';
if ($reload_page) {
$inline_editor_class .= "-reload";
}
}
$nid_field_alias = $this->aliases['nid'];
// No alias is present if the "Link this field to its node" is unchecked.
if (!$nid_field_alias) {
$nid_field_alias = 'nid';
}
$no_tags_value = strip_tags($value);
$id = 'node-' . $values->{$nid_field_alias} . '-' . $field_name;
$inline_editor = '<span id="' . $id . '" class="' . $inline_editor_class . '">' . $no_tags_value . '</span>';
if (!empty($value)) {
if (strcmp($value, $no_tags_value) == 0) {
$value = str_replace($no_tags_value, $inline_editor, $value);
}
else {
$value = str_replace('>' . $no_tags_value . '<', '>' . $inline_editor . '<', $value);
}
}
else {
$value = $inline_editor;
}
}
return $value;
}