Skip to content

Commit

Permalink
fix: Merge pull request #17 from open-y-subprojects/anpolimus-patch-1
Browse files Browse the repository at this point in the history
Fix issues with unpublished amenities
  • Loading branch information
podarok authored Dec 8, 2021
2 parents 68c5def + ec1ec0d commit 66eadb1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ protected function valueForm(&$form, FormStateInterface $form_state) {

if ($tree) {
foreach ($tree as $term) {

if (!$term->isPublished() && !$this->currentUser->hasPermission('administer taxonomy')) {
continue;
}
$choice = new \stdClass();
$choice->option = [$term->id() => str_repeat('-', $term->depth) . \Drupal::service('entity.repository')->getTranslationFromContext($term)->label()];
$options[] = $choice;
Expand All @@ -208,6 +212,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
$query = \Drupal::entityQuery('taxonomy_term')
// @todo Sorting on vocabulary properties -
// https://www.drupal.org/node/1821274.
->condition('status', TRUE)
->sort('weight')
->sort('name')
->addTag('taxonomy_term_access');
Expand Down

0 comments on commit 66eadb1

Please sign in to comment.