<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Core_Widget_HashtagsCloudController extends Engine_Content_Widget_Abstract {

  public function indexAction() {

    if (empty(Engine_Api::_()->getApi('settings', 'core')->getSetting('activity.composer.options')) && !engine_in_array("hashtags", Engine_Api::_()->getApi('settings', 'core')->getSetting('activity.composer.options'))) {
      return $this->setNoRender();
    }

    $limit = $this->_getParam('tag_count', 10);
    $hashtagMapTable = Engine_Api::_()->getDbtable('tags', 'core');
    $hashtagNames = $hashtagMapTable->getTopHashtags($limit);
    if (empty($hashtagNames)) {
      return $this->setNoRender();
    }

    $this->view->hashtags = $hashtagNames;
  }
}
