SHARE
TWEET

Untitled

a guest Sep 15th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top