Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /**
  5. * {@inheritdoc}
  6. */
  7. public function query() {
  8. // get all repeater headlines as our base list of paragraphs.
  9. $query = $this->select('postmeta', 'pm');
  10. $query->innerJoin('posts', 'p', 'pm.post_id = p.id');
  11. $query->fields('pm', ['meta_id', 'post_id', 'meta_key', 'meta_value']);
  12. $query->addField('pm', 'meta_value', 'headline');
  13. $query
  14. ->condition('p.post_type', 'post');
  15. $query->groupBy('pm.post_id');
  16. $query->groupBy('pm.meta_key');
  17. $conditions = new Condition('AND');
  18. $meta_key = $query->escapeLike('weekly_news_repeater_');
  19. $meta_key_suffix = $query->escapeLike('_headline');
  20. $conditions->condition('pm.meta_key', $meta_key . '%' . $meta_key_suffix, 'LIKE');
  21. $query->condition($conditions);
  22.  
  23. return $query;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement