diff --git a/collections.php b/collections.php index 4b2d23c..b8f5e69 100644 --- a/collections.php +++ b/collections.php @@ -380,4 +380,20 @@ private function installEcptsWarning() EOT; }); } + + /** + * Prefix a string w/ the post type string. + * Optionally pass a second argument to override the default "_" separator. + * + * This is especially useful for things like field naming. + * + * @param string $string + * @param string $separator + * + * @return string + */ + public function prefix(string $string, string $separator = "_"): string + { + return sprintf("%s%s%s", $this->type, $separator, $string); + } }