X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftaxonomy%2Ftaxonomy.module;h=179487d3f05ab83be0998e683f24ca7d521893ab;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=e17346ba830315fe5d150ca73df8b28b2d31b058;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/taxonomy/taxonomy.module b/web/core/modules/taxonomy/taxonomy.module index e17346ba8..179487d3f 100644 --- a/web/core/modules/taxonomy/taxonomy.module +++ b/web/core/modules/taxonomy/taxonomy.module @@ -81,13 +81,25 @@ function taxonomy_help($route_name, RouteMatchInterface $route_match) { case 'entity.taxonomy_vocabulary.overview_form': $vocabulary = $route_match->getParameter('taxonomy_vocabulary'); - switch ($vocabulary->getHierarchy()) { - case VocabularyInterface::HIERARCHY_DISABLED: - return '

' . t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', ['%capital_name' => Unicode::ucfirst($vocabulary->label()), '%name' => $vocabulary->label()]) . '

'; - case VocabularyInterface::HIERARCHY_SINGLE: - return '

' . t('%capital_name contains terms grouped under parent terms. You can reorganize the terms in %capital_name using their drag-and-drop handles.', ['%capital_name' => Unicode::ucfirst($vocabulary->label()), '%name' => $vocabulary->label()]) . '

'; - case VocabularyInterface::HIERARCHY_MULTIPLE: - return '

' . t('%capital_name contains terms with multiple parents. Drag and drop of terms with multiple parents is not supported, but you can re-enable drag-and-drop support by editing each term to include only a single parent.', ['%capital_name' => Unicode::ucfirst($vocabulary->label())]) . '

'; + if (\Drupal::currentUser()->hasPermission('administer taxonomy') || \Drupal::currentUser()->hasPermission('edit terms in ' . $vocabulary->id())) { + switch ($vocabulary->getHierarchy()) { + case VocabularyInterface::HIERARCHY_DISABLED: + return '

' . t('You can reorganize the terms in %capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', ['%capital_name' => Unicode::ucfirst($vocabulary->label()), '%name' => $vocabulary->label()]) . '

'; + case VocabularyInterface::HIERARCHY_SINGLE: + return '

' . t('%capital_name contains terms grouped under parent terms. You can reorganize the terms in %capital_name using their drag-and-drop handles.', ['%capital_name' => Unicode::ucfirst($vocabulary->label()), '%name' => $vocabulary->label()]) . '

'; + case VocabularyInterface::HIERARCHY_MULTIPLE: + return '

' . t('%capital_name contains terms with multiple parents. Drag and drop of terms with multiple parents is not supported, but you can re-enable drag-and-drop support by editing each term to include only a single parent.', ['%capital_name' => Unicode::ucfirst($vocabulary->label())]) . '

'; + } + } + else { + switch ($vocabulary->getHierarchy()) { + case VocabularyInterface::HIERARCHY_DISABLED: + return '

' . t('%capital_name contains the following terms.', ['%capital_name' => Unicode::ucfirst($vocabulary->label())]) . '

'; + case VocabularyInterface::HIERARCHY_SINGLE: + return '

' . t('%capital_name contains terms grouped under parent terms', ['%capital_name' => Unicode::ucfirst($vocabulary->label())]) . '

'; + case VocabularyInterface::HIERARCHY_MULTIPLE: + return '

' . t('%capital_name contains terms with multiple parents.', ['%capital_name' => Unicode::ucfirst($vocabulary->label())]) . '

'; + } } } } @@ -201,7 +213,8 @@ function taxonomy_check_vocabulary_hierarchy(VocabularyInterface $vocabulary, $c * content language of the current request. * * @return array - * A $page element suitable for use by drupal_render(). + * A $page element suitable for use by + * \Drupal\Core\Render\RendererInterface::render(). */ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) { return entity_view($term, $view_mode, $langcode); @@ -219,7 +232,8 @@ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) { * content language of the current request. * * @return array - * An array in the format expected by drupal_render(). + * An array in the format expected by + * \Drupal\Core\Render\RendererInterface::render(). */ function taxonomy_term_view_multiple(array $terms, $view_mode = 'full', $langcode = NULL) { return entity_view_multiple($terms, $view_mode, $langcode);