How to link to the CiviEvent registration page from a node field using entity reference
A more elegant approach would be to use field formatters, in a module, e.g. as below. The advantage with this would be that it works with multiple values and automatically disappears once the registration is closed. You could make it do other things when the registration closes also.

/**
 * Implements hook_field_formatter_info().
 */
function mymodule_field_formatter_info() {
  return array(
    'mymodule_civievent_id_register' =&gt; array(
      'label' =&gt; t('CiviEvent Registration Button'),
      'field types' =&gt; array('entityreference'),
    ),
  );
}

function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    case 'mymodule_civievent_id_register':
      civicrm_initialize( );
      foreach ($items as $delta =&gt; $item) {
        try{
          $event = civicrm_api3('Event', 'getsingle', array('id' =&gt; $item['target_id']));
        }
        catch (CiviCRM_API3_Exception $e) {
          // break;
        }
        if ( time() &lt;= strtotime($event['registration_end_date']) ) {
          $element[$delta] = array(
            '#markup' =&gt; l('Register','civicrm/event/register',array(
              'attributes' =&gt; array('class' =&gt; array('button-like')),
              'query' =&gt; array('id' =&gt; $item['target_id'],'reset' =&gt; 1)
            )),
          );
        }
      }
      break;
  }

  return $element;
}