You are here

function _user_entity_diff_additional_options_name in Diff 7.3

Private callback function to render the name field.

File

includes/user.inc, line 14
Provide diff functions for the user module.

Code

function _user_entity_diff_additional_options_name($old_user, $new_user, $context) {
  $row = array(
    '#name' => t('Username'),
    '#states' => array(),
    '#weight' => -5,
    '#settings' => array(
      'show_header' => variable_get('diff_show_header_user', 1),
    ),
  );
  foreach ($context['states'] as $state) {
    switch ($state) {
      case 'rendered':
        $row['#states'][$state] = array(
          '#old' => theme('username', array(
            'account' => $old_user,
          )),
          '#new' => theme('username', array(
            'account' => $old_user,
          )),
        );
        break;

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