private static function _gen_hash($field = '') { do { $hash = DT::random_string(6, true); $entity_ids = \Drupal::entityQuery('node')->condition($field . '.value', $hash, '=')->execute(); } while ($entity_ids); return $hash; }