I noticed the 'allowed_levels' values do not work properly in the API.
When activating 'editability' all levels (but the root level 0) are always able to be extended.
This seems to be due to checking _hierarchical_select_create_new_item_is_allowed() only for the max_depth level.
(hierarchical_select.module line 1776)
(Possible) Solution:
replace line 1782:
$hierarchy->levels[$depth] = array('create_new_item' => $option) + $hierarchy->levels[$depth];
with:

        if(_hierarchical_select_create_new_item_is_allowed($config, $depth)){
          $hierarchy->levels[$depth] = array('create_new_item' => $option) + $hierarchy->levels[$depth];
        }

(sorry not much of a patcher myself)

This seems to fix the problem for me with $enforce_deepest = TRUE.
Hope this helps.

Comments

wim leers’s picture

Title: 'allowed_levels' in 'editability' not working properly -> possible solution » 'allowed_levels' in 'editability' not working properly when 'enforce_deepest' is enabled
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.