Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. edit: function ( props ) {
  2. var checkboxes = [];
  3. var data = [
  4. {
  5. label: 'Checkbox 1',
  6. value: 'checkbox1'
  7. },
  8. {
  9. label: 'Checkbox 2',
  10. value: 'checkbox2'
  11. }
  12. ];
  13. $.each( data, function ( c, fields ) {
  14. checkboxes.push(
  15. el( CheckboxControl, {
  16. key: fields.value,
  17. label: fields.label,
  18. checked: props.myCheckbox,
  19. onChange: function( val ) {
  20. props.setAttributes({ myCheckbox: fields.value });
  21. }
  22. })
  23. )
  24. });
  25. return [
  26. el(
  27. InspectorControls, {
  28. key: 'inspector'
  29. },
  30. el(
  31. PanelBody, {
  32. title: __( 'Settings' )
  33. },
  34. checkboxes
  35. )
  36. ),
  37. el( ServerSideRender, {
  38. block: 'block/name',
  39. attributes: props.attributes
  40. } )
  41. ]
  42. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement