/** * {@inheritdoc} */ public function getButtons() { $buttons = array(); if ($ids = $this->embedButtonQuery->execute()) { $embed_buttons = EmbedButton::loadMultiple($ids); foreach ($embed_buttons as $embed_button) { $buttons[$embed_button->id()] = $this->getButton($embed_button); } } return $buttons; }
/** * Helper method to execute an item query. * * @param \Drupal\Core\Entity\Query\QueryInterface $query * The query to execute. * @param int $limit * (optional) The number of items to return. * * @return \Drupal\aggregator\ItemInterface[] * An array of the feed items. */ protected function executeFeedItemQuery(QueryInterface $query, $limit) { $query->sort('timestamp', 'DESC')->sort('iid', 'DESC'); if (!empty($limit)) { $query->pager($limit); } return $this->loadMultiple($query->execute()); }
/** * {@inheritdoc} */ public function match(ContactInterface $contact, $property = 'value') { $ids = array(); $field = $this->field->getName(); $needle = $contact->get($field)->{$property}; if (!empty($needle)) { $this->query->condition('type', $contact->bundle()); if ($contact->id()) { $this->query->condition('contact_id', $contact->id(), '<>'); } if ($field instanceof FieldConfigInterface) { $field .= '.' . $property; } $this->query->condition($field, $needle, $this->getOperator($property)); $ids = $this->query->execute(); } // Get the score for this field/propery. $score = array($this->field->getName() . '.' . $property => $this->getScore($property)); // Returning an array holding the score as value and the contact id as key. return array_fill_keys($ids, $score); }