Skip to content

Commit

Permalink
Fix prefix issue with multiple installs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmhendricks committed Oct 28, 2018
1 parent 4b205c1 commit a145e1c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/Plugin.php
Expand Up @@ -167,6 +167,22 @@ private function verify_dependencies( $die = false, $activate = false ) {

}

/**
* Append a field prefix as defined in $config
*
* @param string $field_name The string/field to prefix
* @param string $before String to add before the prefix
* @param string $after String to add after the prefix
* @return string Prefixed string/field value
* @since 0.1.0
*/
public static function prefix( $field_name = null, $before = '', $after = '_' ) {

$prefix = $before . self::$config->get( 'prefix' ) . $after;
return $field_name !== null ? $prefix . $field_name : $prefix;

}

/**
* Get Carbon Fields option, with object caching (if available). Currently
* only supports plugin options because meta fields would need to have the
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -22,7 +22,7 @@
"jjgrainger/posttypes": "^2.0.1",
"tgmpa/tgm-plugin-activation": "^2.6.1",
"tareq1988/wordpress-settings-api-class": "dev-master",
"dmhendricks/wordpress-toolkit": "0.4.0",
"dmhendricks/wordpress-toolkit": "^0.4.1",
"underdev/requirements": "^1.3",
"inc2734/wp-customizer-framework": "3.2.3",
"composer/installers": "^1.0.6"
Expand Down

0 comments on commit a145e1c

Please sign in to comment.