Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SlotFill in Status & Availability panel to match existing hook #6300

Merged
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions edit-post/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,32 @@ The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug st
- Required: No


## SlotFills
SlotFills provide plugin or theme authors the ability to add items into the Gutenberg interface. While these slots appear in certain locations,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: are the items above on this page also slotfills? can you check the codebase and if they are move this header section to the top of the page (eg are PluginSidebar, PluginSidebarMoreMenuItem slots)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamsilverstein the do have slots defined in them yes. Perhaps we don't need the SlotFills header and I add the note about the implementation vs location under the header for the actual slot.

it should be noted that they are named and implemented around the function they serve and not their current location, which may change in future iterations.

### PluginPostStatusInfo

_Example_
```jsx
var el = wp.element.createElement;
var __ = wp.i18n.__;
var registerPlugin = wp.plugins.registerPlugin;
var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;

function MyPlugin() {
return (
el(
PluginPostStatusInfo,
{},
__( 'My post status info' )
)
);
};

registerPlugin( 'my-plugin', {
render: MyPlugin,
} )
```


13 changes: 13 additions & 0 deletions edit-post/components/sidebar/plugin-post-status-info/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Defines as extensibility slot for the Status & Visibility panel
*/
import { createSlotFill, PanelRow } from '@wordpress/components';
Copy link
Member

@gziolo gziolo May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import statement should have WordPress dependencies comment as it is done in all other files.


export const { Fill: PluginPostStatusInfo, Slot } = createSlotFill( 'PluginPostStatusInfo' );

PluginPostStatusInfo.Slot = () => (
<PanelRow>
<Slot />
</PanelRow>
);
export default PluginPostStatusInfo;
2 changes: 2 additions & 0 deletions edit-post/components/sidebar/post-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import PostSticky from '../post-sticky';
import PostAuthor from '../post-author';
import PostFormat from '../post-format';
import PostPendingStatus from '../post-pending-status';
import PluginPostStatusInfo from '../plugin-post-status-info';

/**
* Module Constants
Expand All @@ -32,6 +33,7 @@ function PostStatus( { isOpened, onTogglePanel } ) {
<PostSticky />
<PostPendingStatus />
<PostAuthor />
<PluginPostStatusInfo.Slot />
<PostTrash />
</PanelBody>
);
Expand Down
1 change: 1 addition & 0 deletions edit-post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ export function initializeEditor( id, post, settings ) {
} );
}

export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';