src/bbn/appui/menus.php
public function add($id_menu, array $cfg = null): ?string
  {
    $ids = [];
    if ( \is_array($id_menu) ){
      $cfg = $id_menu;
      $id_opt = $this->from_path('menus');      
    }
    if ( !empty($cfg) ){
      if ( \bbn\str::is_uid($id_menu) ){
        $id = $this->pref->add_bit($id_menu, $cfg);
      }
      else {
        $id = $this->pref->add($id_opt, $cfg);
      }
    }
    if ( !empty($id) ){
      if ( \bbn\str::is_uid($id_menu) ){
        $this->delete_cache($id_menu);
      }
      $this->options->delete_cache($id_opt);
      return $id;
    }
    return null;
  }
public function add($id_menu, array $cfg = null): ?string
  {
    $ids = [];
    if ( \is_array($id_menu) ){
      $cfg = $id_menu;
      $id_opt = $this->from_path('menus');      
    }
    if ( !empty($cfg) ){
      if ( \bbn\str::is_uid($id_menu) ){
        $id = $this->pref->add_bit($id_menu, $cfg);
      }
      else {
        $id = $this->pref->add($id_opt, $cfg);
      }
    }
    if ( !empty($id) ){
      if ( \bbn\str::is_uid($id_menu) ){
        $this->delete_cache($id_menu);
      }
      $this->options->delete_cache($id_opt);
      return $id;
    }
    return null;
  }
public function add ( $ id_menu , array $ cfg = null ) : ? string { $ ids = [ ] ; if ( \ is_array ( $ id_menu ) ) { $ cfg = $ id_menu ; $ id_opt = $ this -> from_path ( 'menus' ) ; } if ( ! empty ( $ cfg ) ) { if ( \ bbn \ str :: is_uid ( $ id_menu ) ) { $ id = $ this -> pref -> add_bit ( $ id_menu , $ cfg ) ; } else { $ id = $ this -> pref -> add ( $ id_opt , $ cfg ) ; } } if ( ! empty ( $ id ) ) { if ( \ bbn \ str :: is_uid ( $ id_menu ) ) { $ this -> delete_cache ( $ id_menu ) ; } $ this -> options -> delete_cache ( $ id_opt ) ; return $ id ; } return null ; }
Add menu and delete the chache.

@param string|array $id_parent
@param array $cfg
@return null|string
@internal param $id
Add menu and delete the chache .