cmb2-conditionals icon indicating copy to clipboard operation
cmb2-conditionals copied to clipboard

Any reason not to support option pages?

Open asadkn opened this issue 6 years ago • 4 comments

There seems to be no support for option pages by default. Is there any reason why not?

It can be added by modifying the cmb2-conditionals.js file with:

CMB2ConditionalsInit('.cmb2-options-page', '.cmb2-options-page .cmb-field-list');

And by adding the cmb2-conditional.js enqueu manually in the plugins. Now adding the enqueue is easy, but the JS code should exist in cmb2-conditionals.js by default so it doesn't have to be modified.

asadkn avatar May 23 '18 18:05 asadkn

@asadkn Change this line to:

CMB2ConditionalsInit( '.cmb-form' );

Also, you will have to change this line to something like:

if ( 'admin.php' !== $GLOBALS['pagenow'] || 'arp_options' !== $GLOBALS['plugin_page'] ) {
  return;
}

Or just remove it.

pogla avatar Jul 10 '18 11:07 pogla

Sorry for the GH issue noise, but thanks for the two pointers above for getting this working on options pages. Just what I was needing.

tw2113 avatar Jul 31 '18 23:07 tw2113

@pogla thanks for helping with the solution. Would you mind opening a PR for such a change?

Den ons. 1. aug. 2018, 01:41 skrev Michael Beckwith < [email protected]>:

Sorry for the GH issue noise, but thanks for the two pointers above for getting this working on options pages. Just what I was needing.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jcchavezs/cmb2-conditionals/issues/57#issuecomment-409402542, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7sAr73ugA8TbQAvttgQU38SVjm2Th0ks5uMOsqgaJpZM4UK76e .

--

José Carlos

jcchavezs avatar Aug 01 '18 07:08 jcchavezs

@jcchavezs Sure: #59

pogla avatar Aug 04 '18 15:08 pogla