Exemple #1
0
 /**
  * @param array $options
  * @param array $attributes
  * @param array $settings
  * @return string
  */
 public function postsPicker(array $option, array $attributes, array $settings)
 {
     // debug($option);
     App::import('Component', 'Paginator');
     $Paginator = new PaginatorComponent();
     $posts = $Paginator->paginate(array('limit' => 2));
     $outputHtml = '<div class="gumm-postpicker-input-wrapper">';
     if ($posts) {
         $outputHtml .= '<ul>';
         foreach ($posts as $post) {
             $outputHtml .= '<li>' . $post->post_title . '</li>';
         }
         $outputHtml .= '</ul>';
     }
     $outputHtml .= '</div>';
     return $outputHtml;
 }
 /**
  * Returns settings merged with defaults
  *
  * @param string $alias
  * @return array
  */
 public function getDefaults($alias)
 {
     return array_merge($this->_defaults, parent::getDefaults($alias));
 }
 /**
  * Merges the various options that Pagination uses.
  * Pulls settings together from the following places:
  *
  * - General pagination settings
  * - Model specific settings.
  * - Request parameters
  *
  * The result of this method is the aggregate of all the option sets combined together. You can change
  * PaginatorComponent::$whitelist to modify which options/values can be set using request parameters.
  *
  * THIS HAS BEEN MODIFIED: if `$default['parentModel']` is set, limit is NOT set to the querystring (if aplicable)
  * 
  * @since   1.0
  * @author  Everton Yoshitani <*****@*****.**>
  * @author  CakePHP Core Dev Team
  * @param   string $alias Model alias being paginated, if the general settings has a key with this value
  *   that key's settings will be used for pagination instead of the general ones.
  * @return array Array of merged options.
  */
 public function mergeOptions($alias)
 {
     $defaults = $this->getDefaults($alias);
     if (empty($defaults['parentModel'])) {
         return parent::mergeOptions($alias);
     }
     return $defaults;
 }