-
Notifications
You must be signed in to change notification settings - Fork 1
Including RBM FH in your Theme or Plugin
Eric Defore edited this page Jan 23, 2018
·
2 revisions
If your site previously had RBM FH <=v1.3.9 active as a plugin, ensure to disable it
- Add this submodule as a Git Submodule to your Theme/Plugin or otherwise download the ZIP from the Releases Tab.
- To add it as a Submodule, run:
git submodule add https://github.com/realbig/rbm-field-helpers.git ./whatever/path/you/want
git submodule update --init --recursive
- To add it as a Submodule, run:
- Next, instantiate the Class like so. The Array as the second parameter allows you to provide your own Translations or otherwise replace text Strings throughout RBM FH with text that you'd prefer. By doing this, the translations in use lives inside your own Theme/Plugin, which will make more sense to volunteer translators.
require_once __DIR__ . '/whatever/path/you/want/rbm-field-helpers.php'; $this->field_helpers = new RBM_FieldHelpers( array( 'ID' => <UNIQUE_ID>, // Your Theme/Plugin uses this to differentiate its instance of RBM FH from others when saving/grabbing data 'l10n' => array( 'field_table' => array( 'delete_row' => __( 'Delete Row', <YOUR_TEXT_DOMAIN> ), 'delete_column' => __( 'Delete Column', <YOUR_TEXT_DOMAIN> ), ), 'field_select' => array( 'no_options' => __( 'No select options.', <YOUR_TEXT_DOMAIN> ), 'error_loading' => __( 'The results could not be loaded', <YOUR_TEXT_DOMAIN> ), /* translators: %d is number of characters over input limit */ 'input_too_long' => __( 'Please delete %d character(s)', <YOUR_TEXT_DOMAIN> ), /* translators: %d is number of characters under input limit */ 'input_too_short' => __( 'Please enter %d or more characters', <YOUR_TEXT_DOMAIN> ), 'loading_more' => __( 'Loading more results...', <YOUR_TEXT_DOMAIN> ), /* translators: %d is maximum number items selectable */ 'maximum_selected' => __( 'You can only select %d item(s)', <YOUR_TEXT_DOMAIN> ), 'no_results' => __( 'No results found', <YOUR_TEXT_DOMAIN> ), 'searching' => __( 'Searching...', <YOUR_TEXT_DOMAIN> ), ), 'field_repeater' => array( 'collapsable_title' => __( 'New Row', <YOUR_TEXT_DOMAIN> ), 'confirm_delete' => __( 'Are you sure you want to delete this element?', <YOUR_TEXT_DOMAIN> ), 'delete_item' => __( 'Delete', <YOUR_TEXT_DOMAIN> ), 'add_item' => __( 'Add', <YOUR_TEXT_DOMAIN> ), ), 'field_media' => array( 'button_text' => __( 'Upload / Choose Media', <YOUR_TEXT_DOMAIN> ), 'button_remove_text' => __( 'Remove Media', <YOUR_TEXT_DOMAIN> ), 'window_title' => __( 'Choose Media', <YOUR_TEXT_DOMAIN> ), ), 'field_checkbox' => array( 'no_options_text' => __( 'No options available.', <YOUR_TEXT_DOMAIN> ), ), ), ) );
The "ID" Key in the Constructor is used as a prefix for any database interactions as well as many Actions and Filters. However, if a Field should not utilize this prefix, it can be disabled by passing no_init
as one of its arguments.