Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Change Text of Add/Remove Buttons for Repeatable Select List #630

Closed
brandondove opened this issue Apr 19, 2016 · 5 comments
Closed

Comments

@brandondove
Copy link

WordPress Version 4.5
CMB2 Version 2.2.1

When registering a select list as a repeatable field, changing the add/remove button text adds the button text as an option to the select list because you have to change the text in the options argument which is where the options for the select list live.

Here's a gist showing the issue: https://gist.github.com/brandondove/5e72f7497bbb01a6c1962c9d3846827e

Here's a screenshot of the result:
screen shot 2016-04-18 at 5 14 14 pm

jtsternberg added a commit that referenced this issue Apr 19, 2016
…gs instead of using the `'options'` array. Fixes #630
jtsternberg added a commit that referenced this issue Apr 19, 2016
…gs instead of using the `'options'` array. Fixes #630
@jtsternberg
Copy link
Member

Yep, that was definitely a bug. The text overrides should not be mashed up w/ the option values, so I've created a 'text'/'text_cb' parameter which is used exclusively for text strings. It will fall back to the options value only for back-compatibility. This will be in the next release, but you can use the trunk branch for testing.

@brandondove
Copy link
Author

👍 I'll give that a try.

@tw2113
Copy link
Contributor

tw2113 commented May 15, 2016

Any success with this one @brandondove so we could confirm it and close the issue?

@brandondove
Copy link
Author

@tw2113 Just tested this and it looks good.

@tw2113
Copy link
Contributor

tw2113 commented May 18, 2016

Cool, thanks for the feedback.

@tw2113 tw2113 closed this as completed May 18, 2016
jtsternberg added a commit that referenced this issue Jun 27, 2016
…gs instead of using the `'options'` array. Fixes #630
jtsternberg added a commit that referenced this issue Sep 6, 2016
…gs instead of using the `'options'` array. Fixes #630
jtsternberg added a commit that referenced this issue Sep 8, 2016
…gs instead of using the `'options'` array. Fixes #630
jtsternberg added a commit that referenced this issue Oct 23, 2016
commit fbe1466
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 23:04:43 2016 -0400

    Add CMB2 API to changelog

commit 3be59f2
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 22:50:11 2016 -0400

    Move REST class files into their own subfolder, and update autoloader. Closes #620.

commit 837d399
Merge: 0ab2a68 b21e445
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 22:44:40 2016 -0400

    Merge branch 'trunk' into cmb2-rest-api

commit 0ab2a68
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 22:41:47 2016 -0400

    Document the show_in_rest param a bit better in the example-functions.php

commit a7bc0b5
Merge: d415245 c106412
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 22:37:59 2016 -0400

    Merge branch 'trunk' into cmb2-rest-api

commit d415245
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 22:12:06 2016 -0400

    Include "args" argument in the registered rest routes for boxes/fields.

    This enables better discovery in the schema, and also handles the
    required parameters for us for the DELETE endpoint.

commit 0583ba5
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Oct 22 21:50:15 2016 -0400

    Make sure translatable strings are i18n-ed

commit 65983c4
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 21 13:47:41 2016 -0400

    For the boxes endpoint, remove cmb_id as array key to ensure an array response in JSON

commit e24a482
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 21 13:46:33 2016 -0400

    Create cmb2-ajax-embed tests group to exclude them

commit 297fabf
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 21 13:42:16 2016 -0400

    Only init the routes one time (not once per object)

commit 35e1e72
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Oct 20 17:44:10 2016 -0400

    Properly handle getting/updating fields for different object types.
    Squashed commit of the following:

    commit 7e9ee84159c9b45781f86423c9ddb66d6f8eaf05
    Author: Justin Sternberg <justin@dsgnwrks.pro>
    Date:   Thu Oct 20 17:35:08 2016 -0400

        Fix bleeding global scope by resetting object params at teardown, and uncomment tests

    commit 41c542277b6c9a2c730793f0b8507e178d522fb1
    Author: Justin Sternberg <justin@dsgnwrks.pro>
    Date:   Thu Oct 20 17:31:09 2016 -0400

        Make CMB2_REST::$boxes and CMB2_REST::$type_boxes properties protected

        Also add a get_all method for $boxes

    commit 4e6044d6bd9a3a400286a4c7cf58b10dc93f39df
    Merge: 82a6679 4a91731
    Author: Justin Sternberg <justin@dsgnwrks.pro>
    Date:   Wed Oct 19 11:46:16 2016 -0400

        Merge branch 'trunk' into cmb2-rest-api-update

    commit 82a6679ddcc1b3084c49ee125ed23333793478a6
    Author: Justin Sternberg <justin@dsgnwrks.pro>
    Date:   Wed Oct 19 09:53:36 2016 -0400

        Need to figure out what the deal is with the tests initiations since they run in isolation, but not with all tests

commit f19a751
Merge: ba09324 4a91731
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Oct 20 16:54:25 2016 -0400

    Merge branch 'trunk' into cmb2-rest-api

commit ba09324
Merge: 54fed32 4b0f727
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Oct 18 00:12:33 2016 -0400

    Merge branch 'trunk' into cmb2-rest-api

commit 54fed32
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Oct 18 00:10:15 2016 -0400

    Do not deprecate "row_classes" param for now (but do deprecate if it is callable)

commit 4fadd3d
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 23:03:28 2016 -0700

    Remove todo, not needed as of 4b8bd17

commit 390507f
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 22:59:58 2016 -0700

    Tests for reading/writing user, comment, and term fields via REST API

commit 87866d2
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 22:56:57 2016 -0700

    Register rest fields for each main object type.

    * Add doc blocks
    * Simplify/clarify method names
    * Ensure only cmb2 fields  are shown which match the object type being requested.

commit d8d6b69
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 23:26:36 2016 -0400

    Add new CMB2::box_types method as shorthand for CMB2_Utils::ensure_array

commit c71d5c7
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 23:25:53 2016 -0400

    Remove duplicate call to CMB2_hookup::universal_hooks()

commit 5523036
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 23:25:14 2016 -0400

    New Utils method, ensure_array, with tests

commit 5bdc438
Merge: 7ca84ee 39d9167
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Oct 5 18:52:36 2016 -0400

    Merge branch 'trunk' into cmb2-rest-api

commit 7ca84ee
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Sep 12 12:22:19 2016 -0400

    Refactor, clean up, normalize REST API unit tests, and add registered rest field tests

commit 6808e36
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Sep 12 12:18:40 2016 -0400

    Document several todos, and add CMB2_REST::remove method.

    Also add $object_type to get/update callbacks as PR was merged to
    wp-api: WP-API/WP-API#1714

commit a1cbe72
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Sep 12 12:18:06 2016 -0400

    Fix typo in doc block

commit fa8ed8f
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 10:23:31 2016 -0500

    Clean up _tests_cmb2_manually_load_plugin a bit

commit 4c6f797
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 01:33:12 2016 -0500

    Remove dummy test. I think we found the plugin for travis

commit 013ad0a
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 01:24:50 2016 -0500

    Update dummy tests for more testing

commit de664f9
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 01:15:15 2016 -0500

    Add some more dummy tests to figure out where travis expects the wp-api plugin

commit c73fcb9
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 00:58:21 2016 -0500

    Add some dummy tests to figure out where travis expects the wp-api plugin

commit 30aa4fc
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 00:47:44 2016 -0500

    Attempt to fix rest-api plugin install for travis

commit 8a32f18
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 9 00:15:13 2016 -0500

    Add wp-api as part of testing install and begin integration tests w/ wp-api plugin

commit 80ca11a
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Sep 7 23:43:56 2016 -0500

    Add semicolon to travis command. Props @westonruter

commit b77c89b
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Sep 7 23:36:30 2016 -0500

    Try out the new travis configuration

commit 2a116aa
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:08:42 2016 -0400

    Update test_oembed method to account for being offline

commit 740e3a4
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:07:52 2016 -0400

    Update CMB2 REST API test coverage.. Should all be covered now

commit f9bde33
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:06:49 2016 -0400

    Fix bug where object_type was not required for edit/delete requests (it should be)

commit 9f46758
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:02:36 2016 -0400

    More clarity in error message codes, and fix leftover write/edit typo

commit 9538858
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:01:40 2016 -0400

    Allow hooking to read/edit/delete permissions filters with CMB2 object property callback

commit 164eea6
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 23:00:19 2016 -0400

    field_can method can take CMB2_Field id or object

commit c3dbed4
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 15:28:51 2016 -0400

    s/NAMESPACE/NAME_SPACE since NAMESPACE is a php 7 reserved word.

commit 12cea13
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Tue Sep 6 09:45:20 2016 -0400

    Fix mistakes from rebase

commit 4dee496
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Sep 3 12:41:33 2016 -0400

    Test CMB2_REST core functionality and beginnings of the request tests

commit c0b14f4
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Sep 3 12:40:32 2016 -0400

    Use proper error handling with http status codes

commit 66938b8
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Sep 3 12:38:37 2016 -0400

    Use WP_REST_Server constants (READABLE, etc) for determing show_in_rest status for boxes/fields.

commit ad9668a
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 10:14:41 2016 -0400

    Get started on unit tests for REST API

commit af1887c
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 10:14:21 2016 -0400

    Update example-functions.php w/ more info about rest api

commit 3d86282
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 01:04:39 2016 -0400

    Refactor update/delete methods a bit to abstract duplicate functionality

commit 7fc1de8
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 00:49:11 2016 -0400

    If options page, trigger the option save

commit ab17ded
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 00:48:32 2016 -0400

    use sanitize_text_field on the object_id, since options page ids are strings

commit d74f907
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Sep 2 00:15:58 2016 -0400

    Add ability to update or delete field value (with valid permissions)

commit 4787e2d
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Sep 1 23:24:37 2016 -0400

    Many updates to the REST API, inc. making work w/o wp-api plugin, etc

    * Fixed recursion errors by not accounting for new callable field parameters
    * Append object query args to _links array links
    * Add cmb2_request_items_permissions_check filter
    * s/register_api_field/register_rest_field
    * Update/add doc blocks
    * Only include value in response if object_type and object_id are provided

commit aba4cc3
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Sep 1 16:33:48 2016 -0400

    Assign object_id and object_type properly, using the helper methods

commit 239f26c
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Jun 27 12:10:58 2016 -0400

    Fix merge issues

commit 76b96dd
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Jun 27 11:08:36 2016 -0400

    Add field `'column'` parameter, and the concept of field value display.

    You can now set admin post-listing columns with an extra field
    parameter, `'column' => true,`. If you want to dictate what position
    the column is, use `'column' => array( 'position' => 2 ),`. If you
    want to dictate the column title (instead of using the field `'name'`
    value), use `'column' => array( 'name' => 'My Column' ),`. If you need
    to specify the column display callback, set the `'display_cb'` parameter
    to [a callback function](https://github.com/WebDevStudios/CMB2/wiki/Field-Parameters#render_row_cb).

commit 336a04f
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Apr 18 22:16:58 2016 -0400

    Introduce new `'text'` field parameter for overriding CMB2 text strings instead of using the `'options'` array. Fixes #630

commit f14881c
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Jan 20 17:09:02 2016 -0600

    Document linking and prepare_links method

commit c351323
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Jan 20 16:58:01 2016 -0600

    non-standard links fields should be urls (which should be used to define the link)

commit 01f352a
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Jan 20 16:56:29 2016 -0600

    Refactor to use CMB2_REST objects instead of CMB2 objects

commit 340c7ff
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Jan 18 17:54:14 2016 -0500

    Update initiate_request method, and be sure to pass context to initiate_request calls

commit 6a40854
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Jan 18 17:46:36 2016 -0500

    Remove the rest_read and rest_write properties from the CMB2 class

commit b15fad9
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Jan 18 17:45:16 2016 -0500

    Add CMB2::set_prop() method for setting CMB2 properties

commit f2a8406
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Mon Dec 14 15:40:58 2015 -0500

    Move methods to appropriate classes, clean up, and get embeddable links working.

commit 8353dd4
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Sat Dec 12 10:11:03 2015 -0500

    Remove debug stuff

commit 07ffdef
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Dec 10 17:47:24 2015 -0500

    Clean up REST API classes and create classes specifically for handling api boxes and api fields

commit 16b7157
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 23:04:28 2015 -0500

    Allow object_id and object_type parameters to specify for the return. Also check for "render" query var to add more data to endpoints

commit 55ed091
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 23:01:27 2015 -0500

    Register JS dependies to the filed, and let it handle enqueueing

commit db1a1d3
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 22:58:56 2015 -0500

    a bit of cleanup

commit 3b01c7e
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 15:43:58 2015 -0500

    Improve docs, add filters, use the response object add_link api, etc

commit 55d6e8c
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 15:42:03 2015 -0500

    Remove schema filter as it is too broad. May implement if a need comes up

commit 0960da5
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Dec 9 15:41:33 2015 -0500

    Only do rest api hooks if register_api_field function exists

commit c0fe88e
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Nov 12 13:35:28 2015 -0500

    move version to 2.2.0

commit 5670aea
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Nov 12 11:04:32 2015 -0500

    Clean up, make things work, add fields endpoint, and box endpoint. a lot of TODOs to work through yet.

commit 84c6c9d
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Nov 12 11:02:51 2015 -0500

    New static property, CMB2_Field::$callable_fields, used to determine if a field parameter is callable

commit 889cb63
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Thu Nov 12 11:00:43 2015 -0500

    Set rest read/write status on cmb object instead of CMB2_REST_Access object.

commit 0bad2da
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Nov 11 23:53:04 2015 -0500

    Clean up the rest endpoints class. Still work to do.

commit 83aed3f
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Nov 11 23:52:12 2015 -0500

    Make hookup/rest an extended class of new CMB2_Hookup_Base. Also rework to handle rest saving/displaying via the post get/post endpoints.

commit 2e32e7f
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Wed Nov 11 23:46:21 2015 -0500

    init.php is not for hooking in. We'll do that later

commit 571e706
Author: modemlooper <modemlooper@gmail.com>
Date:   Sat Nov 7 11:59:00 2015 -0800

    add some objects to endpoint methods

commit 30fde29
Author: modemlooper <modemlooper@gmail.com>
Date:   Sat Oct 31 09:47:38 2015 -0700

    add endpoint class

commit 281e78d
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 30 14:48:56 2015 -0400

    Revert "Get REST stuff out of trunk"

    This reverts commit 10d990d.

commit 32ab088
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 30 03:14:14 2015 -0400

    More updates to show_in_rest logic to allow individual field overrides

commit ac50e09
Author: Justin Sternberg <justin@dsgnwrks.pro>
Date:   Fri Oct 30 00:22:02 2015 -0400

    Get things started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants