Shows a list of matching terms.

@param int $vocabularyId Vocabulary's ID for which render its terms
@return void
776717
public function search($vocabularyId)
    {
        $this->loadModel('Taxonomy.Terms');
        $out = [];
        $text = $this->request->query['q'];
        $terms = $this->Terms
            ->find()
            ->select(['id', 'name'])
            ->where(['name LIKE' => "%%{$text}%%", 'vocabulary_id' => $vocabularyId])
            ->limit(10)
            ->all();

        foreach ($terms as $term) {
            $out[] = ['id' => $term->id, 'name' => $term->name];
        }

        die(json_encode($out));
    }
122252
public function getVocabularyByNameAsArray($name) {
    $vocabulary = $this->vocabulary->where('name', $name)->first();

    if (!is_null($vocabulary)) {
      return $vocabulary->terms->pluck('name', 'id')->toArray();
    }

    return [];
  }
124441
private function updateWordObjectCount(array $wordId, array $columns)
    {
        $query = $this->dbHandler->createUpdateQuery();
        $query->update($this->dbHandler->quoteTable('ezsearch_word'));

        foreach ($columns as $column => $value) {
            $query->set($this->dbHandler->quoteColumn($column), $value);
        }

        $query->where($query->expr->in($this->dbHandler->quoteColumn('id'), $wordId));

        $stmt = $query->prepare();
        $stmt->execute();
    }
51261
public function updateTags(int $conversationId, $tags): void
    {
        if ($tags instanceof TagsCollection) {
            $tagsCollection = $tags;
        } else {
            if ($tags instanceof Collection) {
                $tagNames = [];
                foreach ($tags as $tag) {
                    $tagNames[] = $tag->getName();
                }
                $tags = $tagNames;
            }

            $tagsCollection = new TagsCollection();
            $tagsCollection->setTags($tags);
        }

        $this->restClient->updateResource(
            $tagsCollection,
            sprintf('/v2/conversations/%d/tags', $conversationId)
        );
    }
1143267
private function deleteExistingTerms($vid = null)
    {
        $termStorage = $this->entityTypeManager->getStorage('taxonomy_term');
        //Load all vocabularies
        $vocabularies = $this->getVocabularies();

        if ($vid === 'all') {
            $vid = array_keys($vocabularies);
        } else {
            $vid = [$vid];
        }

        foreach ($vid as $item) {
            $vocabulary = $vocabularies[$item];
            $terms = $termStorage->loadTree($vocabulary->id());

            if (empty($terms)) {
                $this->getIo()->error(
                    sprintf(
                        $this->trans('commands.taxonomy.term.delete.messages.nothing'),
                        $item
                    )
                );
            } else {
                foreach ($terms as $term) {
                    $treal = $termStorage->load($term->tid);

                    if ($treal !== null) {
                        $this->getIo()->info(
                            sprintf(
                                $this->trans('commands.taxonomy.term.delete.messages.processing'),
                                $term->name
                            )
                        );
                        $treal->delete();
                    }
                }
            }
        }
    }
131014
public function hasTerm($term_id) {
    $term = ($term_id instanceof Term) ? $term_id : Term::findOrFail($term_id);

    $term_relation = [
      'term_id' => $term->id,
      'vocabulary_id' => $term->vocabulary_id,
    ];

    return ($this->related()->where('term_id', $term_id)->count()) ? TRUE : FALSE;
  }
1255865
public function termGet(int $term_id)
    {
        $value = get_term_meta($term_id, $this->getName(), ! $this->getOption('multiple', false));

        if (! empty($value)) {
            $this->setValue($value);
        }
    }
614944
protected function getTerm($term_name, $vocabulary_id = 'tags') {
    $term_name = trim($term_name);
    $term_storage = $this->entityTypeManager->getStorage('taxonomy_term');
    $terms = $term_storage->loadByProperties([
      'name' => $term_name,
      'vid' => $vocabulary_id,
    ]);
    if (!$terms) {
      $term = $term_storage->create([
        'name' => $term_name,
        'vid' => $vocabulary_id,
        'path' => ['alias' => '/' . Html::getClass($vocabulary_id) . '/' . Html::getClass($term_name)],
      ]);
      $term->save();
      $this->storeCreatedContentUuids([$term->uuid() => 'taxonomy_term']);
      return $term->id();
    }
    $term = reset($terms);
    return $term->id();
  }
1088230
protected function taxonomyVocabularyLoadMultiple(array $vids = array()) {
    $vocabularies = taxonomy_get_vocabularies();
    if ($vids) {
      return array_intersect_key($vocabularies, array_flip($vids));
    }
    return $vocabularies;
  }
564513
public function vocabulary($id)
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabulary = $this->Vocabularies->get($id);
        $terms = $this->Vocabularies->Terms
            ->find()
            ->where(['vocabulary_id' => $id])
            ->order(['lft' => 'ASC'])
            ->all()
            ->map(function ($term) {
                $term->set('expanded', true);

                return $term;
            })
            ->nest('id', 'parent_id');

        if (!empty($this->request->data['tree_order'])) {
            $items = json_decode($this->request->data['tree_order']);

            if ($items) {
                unset($items[0]);
                $entities = [];

                foreach ($items as $key => $item) {
                    $term = $this->Vocabularies->Terms->newEntity([
                        'id' => $item->item_id,
                        'parent_id' => intval($item->parent_id),
                        'lft' => ($item->left - 1),
                        'rght' => ($item->right - 1),
                    ], ['validate' => false]);
                    $term->isNew(false);
                    $term->dirty('id', false);
                    $entities[] = $term;
                }

                $this->Vocabularies->Terms->unbindSluggable();
                $this->Vocabularies->Terms->connection()->transactional(function () use ($entities) {
                    foreach ($entities as $entity) {
                        $this->Vocabularies->Terms->save($entity, ['atomic' => false]);
                    }
                });
                // don't trust "left" and "right" values coming from user's POST
                $this->Vocabularies->Terms->addBehavior('Tree', ['scope' => ['vocabulary_id' => $vocabulary->id]]);
                $this->Vocabularies->Terms->recover();
                $this->Flash->success(__d('taxonomy', 'Vocabulary terms tree has been reordered'));
            } else {
                $this->Flash->danger(__d('taxonomy', 'Invalid information, check you have JavaScript enabled'));
            }

            $this->redirect($this->referer());
        }

        $this->title(__d('taxonomy', 'Vocabulary’s Terms'));
        $this->set(compact('vocabulary', 'terms'));
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'index'])
            ->push("\"{$vocabulary->name}\"", ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'edit', $vocabulary->id])
            ->push(__d('taxonomy', 'Terms'), '#');
    }
629764
public function edit($id)
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabulary = $this->Vocabularies->get($id);

        if ($this->request->data()) {
            $vocabulary = $this->Vocabularies->patchEntity($vocabulary, $this->request->data, [
                'fieldList' => [
                    'name',
                    'description',
                ],
            ]);

            if ($this->Vocabularies->save($vocabulary, ['atomic' => true])) {
                $this->Flash->success(__d('taxonomy', 'Vocabulary has been saved!'));
                $this->redirect($this->referer());
            } else {
                $this->Flash->danger(__d('taxonomy', 'Vocabulary could not be saved, please check your information'));
            }
        }

        $this->title(__d('taxonomy', 'Editing Vocabulary'));
        $this->set('vocabulary', $vocabulary);
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'index'])
            ->push(__d('taxonomy', 'Editing vocabulary'), '#');
    }
1098242
public function show($id, $translationId)
    {
        $content = $this->getContent($id);
        if (!empty($content)) {
            $this->authorize('read', $content);
            $translation = $this->repository->getContentTranslationById($content, $translationId);
            if (!empty($translation)) {
                return $this->respondWithSuccess($translation, new ContentTranslationTransformer);
            }
        }
        return $this->respondNotFound();
    }
1285158
public function delete($id)
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabulary = $this->Vocabularies->get($id, [
            'conditions' => [
                'locked' => 0
            ]
        ]);

        if ($this->Vocabularies->delete($vocabulary)) {
            $this->Flash->success(__d('taxonomy', 'Vocabulary has been successfully deleted!'));
        } else {
            $this->Flash->danger(__d('taxonomy', 'Vocabulary could not be deleted, please try again'));
        }

        $this->title(__d('taxonomy', 'Delete Vocabulary'));
        $this->redirect($this->referer());
    }
600942
public function addTerm($term_id) {
    $term = ($term_id instanceof Term) ? $term_id : Term::findOrFail($term_id);

    $term_relation = [
      'term_id' => $term->id,
      'vocabulary_id' => $term->vocabulary_id,
    ];

    return $this->related()->save(new TermRelation($term_relation));
  }
1085747
public function setTerms($terms, $vocabulary_id = null)
    {
        $this->removeTerms($vocabulary_id);

        foreach ($terms as $term_id) {
            $this->addTerm($term_id);
        }
    }
670864
def show(self):
		"""'
		"""


		if self.classname()=="Corpus":
			for text in self.children:
				text.om("## showing Text " + text.name)
				text.show()
		else:
			words=self.words()
			for i in range(len(words)):
				word=words[i]
				word.om(str(i+1).zfill(6)+"\t"+str(word.output_minform()),conscious=False)
208864
public function listAlias()
    {
        $this->actionListAlias();
        $this->setTitleListAlias();
        $this->setBreadcrumbListAlias();
        $this->setFilterListAlias();
        $this->setPagerListAlias();

        $this->setData('aliases', $this->getListAlias());
        $this->setData('handlers', $this->alias->getHandlers());
        $this->outputListAlias();
    }