useBlockConditions.js
20 lines
| 1 | const { useSelect } = wp.data; |
| 2 | |
| 3 | /** |
| 4 | * @returns {{functions, operators}} |
| 5 | */ |
| 6 | function useBlockConditions() { |
| 7 | const [ operators, functions ] = useSelect( select => { |
| 8 | return [ |
| 9 | select( 'jet-forms/block-conditions' ).getOperators(), |
| 10 | select( 'jet-forms/block-conditions' ).getFunctions(), |
| 11 | ]; |
| 12 | }, [] ); |
| 13 | |
| 14 | return { |
| 15 | operators, |
| 16 | functions, |
| 17 | }; |
| 18 | } |
| 19 | |
| 20 | export default useBlockConditions; |