EntityReference_SelectionHandler_Generic_commerce_coupon.class.php in Commerce Coupon 7
File
plugins/selection/EntityReference_SelectionHandler_Generic_commerce_coupon.class.php
View source
<?php
class EntityReference_SelectionHandler_Generic_commerce_coupon extends EntityReference_SelectionHandler_Generic {
public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityFieldQuery($match, $match_operator);
if (isset($match)) {
$query
->fieldCondition('commerce_coupon_code', 'value', $match, $match_operator);
}
return $query;
}
public function getLabel($entity) {
$wrapper = entity_metadata_wrapper('commerce_coupon', $entity);
return $wrapper->commerce_coupon_code
->value();
}
}