| | |
| | | <?php |
| | | namespace JVBase\ui; |
| | | |
| | | use JVBase\base\Site; |
| | | use JVBase\managers\UserTermsManager; |
| | | use JVBase\meta\Form; |
| | | use JVBase\registrar\Registrar; |
| | |
| | | |
| | | protected function taxConfig(string $taxonomy, string $label = ''):array |
| | | { |
| | | $isVerified = jvbUserIsVerified(); |
| | | $isVerified = $this->userIsVerified(); |
| | | $label = ($label === '') ? Registrar::getInstance($taxonomy)->getPlural() : $label; |
| | | return [ |
| | | 'type' => 'taxonomy', |
| | |
| | | ]; |
| | | } |
| | | |
| | | protected function userIsVerified():bool |
| | | { |
| | | $membership = Site::membership(); |
| | | |
| | | return !($membership && $membership->has('member_verified')) || current_user_can('skip_moderation'); |
| | | } |
| | | |
| | | public function addSearch():self |
| | | { |
| | | $this->hasSearch = true; |
| | |
| | | if ($limit) { |
| | | if ($limit === 'user') { |
| | | $manager = new UserTermsManager(); |
| | | return $manager->getUserTerms($this->user_id, $taxonomy); |
| | | return $manager->fetchUserTerms($this->user_id, $taxonomy); |
| | | } else { |
| | | $limit = (int)$limit; |
| | | } |