Closed jtsternberg closed 8 years ago
To be clear, a Type object should be initiated which is related to the field type you are using. Which in your case is the CMB2_Type_Select
type. Types can be found here: https://github.com/WebDevStudios/CMB2/tree/master/includes/types and they are initiated here: https://github.com/WebDevStudios/CMB2/blob/master/includes/CMB2_Types.php#L336-L509
(Just documenting for the future)
To try and address some back-compatibility issues, I've put in a shim: https://github.com/WebDevStudios/CMB2/commit/c6e933127681e79b5769224220ea438240d75df9. Notice, it will still throw a _doing_it_wrong
notice, so this change in the PR is still required.
But there is still a problem: concat_items
doesn't add checked
attribute to options, because there is no value in CMB2_Type_Select
object at the moment. For now I've added my own method which concatenates options list but wondering if there is a better solution. I've tried to initiate types object with value passed as argument, but it doesn't show up.
The type object is needs to be initiated and added to the types object in order for some of the methods to work (like
concat_items
). This ensures it will work in the future while also still working for older versions of CMB2.