You are here

protected static function FeedsDateTimeElement::readDateField in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsParser.inc \FeedsDateTimeElement::readDateField()
  2. 7 plugins/FeedsParser.inc \FeedsDateTimeElement::readDateField()

Helper method for buildDateField(). Build a FeedsDateTimeElement object from a standard formatted node.

1 call to FeedsDateTimeElement::readDateField()
FeedsDateTimeElement::buildDateField in plugins/FeedsParser.inc
Build a entity's date field from our object.

File

plugins/FeedsParser.inc, line 608
Contains FeedsParser and related classes.

Class

FeedsDateTimeElement
Defines a date element of a parsed result (including ranges, repeat).

Code

protected static function readDateField($entity, $field_name, $delta = 0, $language = LANGUAGE_NONE) {
  $ret = new FeedsDateTimeElement();
  if (isset($entity->{$field_name}[$language][$delta]['date']) && $entity->{$field_name}[$language][$delta]['date'] instanceof FeedsDateTime) {
    $ret->start = $entity->{$field_name}[$language][$delta]['date'];
  }
  if (isset($entity->{$field_name}[$language][$delta]['date2']) && $entity->{$field_name}[$language][$delta]['date2'] instanceof FeedsDateTime) {
    $ret->end = $entity->{$field_name}[$language][$delta]['date2'];
  }
  return $ret;
}