Skip to content

Instantly share code, notes, and snippets.

@khalil-tabbal
Created January 21, 2014 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khalil-tabbal/8542635 to your computer and use it in GitHub Desktop.
Save khalil-tabbal/8542635 to your computer and use it in GitHub Desktop.
patch field.datetime.php
/**
* Pre field add
*
* Before we add the field to a stream
*
* @access public
* @param obj
* @param obj
* @return void
*/
public function field_assignment_construct($field, $stream)
{
// Is this in UNIX time?
if (isset($field->field_data['storage']) and $field->field_data['storage'] == 'unix')
{
$this->db_col_type = 'int';
return true;
}
else
{
// If not unix, let's see if we can need the
// time part in our MySQL date/time
if ($field->field_data['use_time'] == 'no')
{
$this->db_col_type = 'date';
}
elseif ($field->field_data['use_time'] == 'yes')
{
$this->db_col_type = 'datetime';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment