I want to show a multiple select element in the sidebar when editing a page in admin, where I can save the selected values in a metakey. Of course also load the selected values upon load of page-edit in admin. I manage to show the list, but I don’t know how to save it i […]
Categories
Multiple Select on Gutenberg Sidebar as metakey
- Post author By Marcia D.
- Post date August 1, 2020
- No Comments on Multiple Select on Gutenberg Sidebar as metakey
- Tags __file__, __FILE__ ) ); $custom_fields = [ 'somemetakey', 'auth_callback' => function () { return current_user_can( 'edit_posts' ); } ] ); } } add_action(, 'custom_field', 'getEntityRecords', 'Loading data..' ); } var theOptions = []; const list = props.users.map( user => { let rolesArr = user.roles; for (v, 'register_metakey_ac' ); JS: ( function( wp ) { var registerPlugin = wp.plugins.registerPlugin; var PluginSidebar = wp.editPost.PluginS, 'root', 'show_in_rest' => false, 'single' => true, 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', ) ); wp_register_style( 'plugin-sidebar-css', ]; foreach ( $custom_fields as $custom_field ) { register_post_meta( 'page', { className: 'plugin-sidebar-content' }, { label: 'Access Control', { name: 'themeta-sidebar', { render: function() { return el( PluginSidebar, {type: 'array', }, and documentation with examples is close to none. I have found 0 examples using a type='array' in a register_post_meta function. Please help, array( 'wp-plugins', but I don't know how to save it i WP. PHP function register_metakey_ac() { wp_register_script( 'plugin-sidebar-js', el( 'div', el( MetaSelectControl ) ) ); } }); } )( window.wp ); I am new to all this Gutenberg React Components thing. I think the, I want to show a multiple select element in the sidebar when editing a page in admin, icon: 'admin-post', isRequesting: isResolving( 'core', multiple = TRUE, null, onChange: ( value ) => { props.setMetaValue( value ); }, options: theOptions, plugins_url( 'plugin-sidebar.css', plugins_url( 'plugin-sidebar.js', props ) { const query = { per_page: 99 }; return { metaValue: select( 'core/editor' ).getEditedPostAttribute( 'met, props ) { return { setMetaValue: function( metaValue ) { dispatch( 'core/editor' ).editPost( { meta: { [, query, query ] ) }; } ) ) ( function( props ) { if ( props.isRequesting ) { // "loading" indicator return el( 'div', title: 'Meta AC Example', User>();, users: wp.data.select( 'core' ).getEntityRecords( 'root', value: props.metaValue }); }); registerPlugin( 'themeta-sidebar', value: user.id}) } }; } ); return el( SelectControl, where I can save the selected values in a metakey. Of course also load the selected values upon load of page-edit in admin. I manage to show, withSelect( function( select