| | |
| | | |
| | | use JVBase\Instance; |
| | | use JVBase\managers\Cache; |
| | | use JVBase\managers\Errors; |
| | | use JVBase\managers\TaxonomyRelationships; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\rest\Rest; |
| | |
| | | $this->cacheName = 'terms'; |
| | | parent::__construct(); |
| | | $this->cache = Cache::for('terms', 'term'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | } |
| | | |
| | | |
| | | $this->per_page = 20; |
| | | |
| | |
| | | |
| | | $membership = Site::membership(); |
| | | if ($membership && $membership->has('term_approval')) { |
| | | $approval_routes = JVB()->routes('approvals'); |
| | | $approval_routes = ApprovalRoutes::getInstance(); |
| | | $request_id = $approval_routes->createTermApprovalRequest( |
| | | $user_id, |
| | | $taxonomy, |
| | |
| | | ], 201); // 201 Created |
| | | |
| | | } catch (Exception $e) { |
| | | JVB()->error()->log( |
| | | Errors::getInstance()->log( |
| | | 'terms', |
| | | 'Term creation failed: ' . $e->getMessage(), |
| | | ['user_id' => $user_id, 'taxonomy' => $taxonomy, 'name' => $name] |