You are here

public static function FeedImportFilter::setProperty in Feed Import 8

Same name in this branch
  1. 8 feed_import_base/filters/feed_import_default_filters.php \FeedImportFilter::setProperty()
  2. 8 feed_import_base/src/Filter/FeedImportFilter.php \Drupal\feed_import_base\FeedImportFilter::setProperty()

Set property to array or object

@parem string $property Property name

Parameters

array|object $field: Where to set property

mixed $value: Value of property

Return value

mixed The field with property set

File

feed_import_base/src/Filter/FeedImportFilter.php, line 126

Class

FeedImportFilter
This class contains default filters for feed import.

Namespace

Drupal\feed_import_base

Code

public static function setProperty($field, $property = NULL, $value = NULL) {
  if (!empty($property)) {
    if (is_array($field)) {
      $field[$property] = $value;
    }
    elseif (is_object($field)) {
      $field->{$property} = $value;
    }
  }
  return $field;
}