/** * WordPress dependencies */ import { Component, Fragment } from '@wordpress/element'; import { PanelBody, Placeholder, SelectControl, Disabled, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { InspectorControls, ServerSideRender, } from '@wordpress/editor'; const getEditComponent = ( blockName ) => { return class extends Component { constructor() { super( ...arguments ); this.state = { isTaxonomiesLoaded: false, }; } async componentDidMount() { this.isStillMounted = true; } async componentDidUpdate() { } componentWillUnmount() { this.isStillMounted = false; } render() { const { className, attributes, setAttributes, posts, selectedPostType, postTypes } = this.props; const { postId } = attributes; const labels = selectedPostType.labels || {}; const PostTypeControls = ( ( { label: type.name, value: type.slug } ) ) } onChange={ ( postType ) => { setAttributes( { postId: undefined } ); setAttributes( { postType } ); } } /> ); const PostControls = ( ( { label: post.title.rendered, value: post.id, } ) ), ] } onChange={ ( value ) => { setAttributes( { postId: value ? parseInt( value ) : undefined } ); } } /> ); const title = sprintf( __( '%s Block Setting', 'advanced-posts-blocks' ), labels.name ); const inspectorControls = ( { PostTypeControls } { PostControls } ); if ( ! postId ) { return ( { inspectorControls } { __( 'Post Not Found', 'advanced-posts-blocks' ) } ); } return ( { inspectorControls } ); } }; }; export default getEditComponent;