You are here

function _node_entity_diff_additional_options_title in Diff 7.3

Private callback function to render the title field.

File

includes/node.inc, line 11
Provide diff functions for the node module.

Code

function _node_entity_diff_additional_options_title($old_node, $new_node, $context) {
  $type = node_type_get_type($new_node);
  $row = array(
    '#name' => $type->title_label,
    '#states' => array(),
    '#weight' => -5,
    '#settings' => array(
      'show_header' => variable_get('diff_show_header_node', 1),
    ),
  );
  foreach ($context['states'] as $state) {
    switch ($state) {
      case 'rendered':
        $row['#states'][$state] = array(
          '#old' => l($old_node->title, 'node/' . $old_node->title),
          '#new' => l($new_node->title, 'node/' . $new_node->title),
        );
        break;

      // We specify a default so that the title is allows compared.
      case 'raw':
      default:
        $row['#states'][$state] = array(
          '#old' => array(
            $old_node->title,
          ),
          '#new' => array(
            $new_node->title,
          ),
        );
        break;
    }
  }
  return $row;
}