src/Library/Helper/Html.php
public static function getNewId($reference = null, $base_id = null)
    {
        if (empty($reference)) {
            $reference = uniqid();
        }
        if (true===$base_id) {
            $base_id = $reference;
        }
        if (!is_null($base_id)) {
            $new_id = $base_id;
            while(in_array($new_id, self::$dom_id_register)) {
                $new_id = $base_id.'_'.uniqid();
            }
        } else {
            $new_id = uniqid();
            while(in_array($new_id, self::$dom_id_register)) {
                $new_id = uniqid();
            }
        }
        self::$dom_id_register[$reference] = $new_id;
        return $new_id;
    }
public static function getNewId($reference = null, $base_id = null)
    {
        if (empty($reference)) {
            $reference = uniqid();
        }
        if (true===$base_id) {
            $base_id = $reference;
        }
        if (!is_null($base_id)) {
            $new_id = $base_id;
            while(in_array($new_id, self::$dom_id_register)) {
                $new_id = $base_id.'_'.uniqid();
            }
        } else {
            $new_id = uniqid();
            while(in_array($new_id, self::$dom_id_register)) {
                $new_id = uniqid();
            }
        }
        self::$dom_id_register[$reference] = $new_id;
        return $new_id;
    }
public static function getNewId ( $ reference = null , $ base_id = null ) { if ( empty ( $ reference ) ) { $ reference = uniqid ( ) ; } if ( true === $ base_id ) { $ base_id = $ reference ; } if ( ! is_null ( $ base_id ) ) { $ new_id = $ base_id ; while ( in_array ( $ new_id , self :: $ dom_id_register ) ) { $ new_id = $ base_id . '_' . uniqid ( ) ; } } else { $ new_id = uniqid ( ) ; while ( in_array ( $ new_id , self :: $ dom_id_register ) ) { $ new_id = uniqid ( ) ; } } self :: $ dom_id_register [ $ reference ] = $ new_id ; return $ new_id ; }
Create and get a new DOM unique ID

@param   string      $reference  A reference used to store the ID (and retrieve it - by default, a uniqid)
@param   string|bool $base_id    A string that will be used to construct the ID, if set to `true`, the reference will be used as `$base_id`)
@return  string      The unique ID created
Create and get a new DOM unique ID