Skip to content

Commit

Permalink
Limit Parents Levels (getgrav#1298)
Browse files Browse the repository at this point in the history
* Adding parents levels limit

* Adding parents levels limit
  • Loading branch information
hugoaf authored and Flamenco committed Mar 15, 2018
1 parent df01bff commit cdcb2cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ form:
folder: Show folder
fullpath: Show fullpath

pages.parents_levels:
type: text
label: Parents Levels
size: small
help: The number of levels to show in parent select list

google_fonts:
type: toggle
label: Use Google Fonts
Expand Down
4 changes: 3 additions & 1 deletion themes/grav/templates/forms/fields/parents/parents.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
{% elseif show_parents == 'fullpath' %}
{% set show_fullpath_val = true %}
{% endif %}

{% set limit_levels_val = config.get('plugins.admin.pages.parents_levels') %}

{% set defaults = {show_root:true, show_all:true, show_slug:show_slug_val, show_fullpath:show_fullpath_val, default:last_page_route} %}
{% set defaults = {show_root:true, show_all:true, show_slug:show_slug_val, show_fullpath:show_fullpath_val, default:last_page_route, limit_levels:limit_levels_val} %}
{% set field = field|merge(defaults) %}
{{ parent() }}
{% endblock %}

0 comments on commit cdcb2cc

Please sign in to comment.