/**
  *  Javascript strings Localization wrapper for Drupal
  * @param $locale
  */
 public function l10n($locale)
 {
     $strings = DruniqueAPIUtil::call('page_blocks.json', ['tag' => 'javascript'], $locale);
     $strings = Hash::combine($strings, '{s}.title', '{s}.content');
     $this->set(['result' => $strings, '_serialize' => 'result']);
     $this->response->cache('-1 minute', '+1 days');
 }
 /**
  * Get drupal data
  * $config = [
  *   'api_url' => 'page_data.json',
  *   'duration' => 'short',
  *   'caching'  => true,
  *   'locale'   => 'en_US
  * ];
  * @param $config
  * @param $data
  * @return null
  */
 public function getData($config, &$data)
 {
     if (empty($config)) {
         return null;
     }
     /**
      * Get defaults
      */
     $config = array_merge($this->getDefaultConfig(), $config);
     /**
      * Setup params
      */
     if (empty($config['params'])) {
         $config['params'] = ['tag' => $config['action'] . '-page'];
     }
     $data = DruniqueAPIUtil::call($config['api_url'], $config['params'], $config['locale']);
 }
 public function posts()
 {
     $returnPosts = array();
     // foreach ($this->FacebookWallPost->partyPosts() as $post) {
     //     $returnPosts[] = array(
     //         "name" => $post['FacebookWallPost']['name'],
     //         "img" => $post['FacebookWallPost']['image_path'],
     //         "description" => $post['FacebookWallPost']['description'],
     //         "caption" => $post['FacebookWallPost']['caption'],
     //         "partyname" => $this->party['Party']['name']
     //     );
     // }
     $page_data = DruniqueAPIUtil::call('posts.json', array('active' => 1), $this->Session->read('Config.language'));
     foreach ($page_data as $block) {
         $title = $block['title'];
         $returnPosts[$title]['name'] = $block['title'];
         $returnPosts[$title]['img'] = $block['post_image'];
         $returnPosts[$title]['description'] = html_entity_decode($block['description'], ENT_QUOTES);
         $returnPosts[$title]['caption'] = $block['caption'];
         $returnPosts[$title]['partyname'] = $this->party['Party']['name'];
     }
     $this->sendSuccess($returnPosts);
 }