<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[8712] sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks: WordCamp Blocks: Refactor Speakers to use data store, other improvements</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/8712">8712</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/8712","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>coreymckrill</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-05-01 22:11:33 +0000 (Wed, 01 May 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp Blocks: Refactor Speakers to use data store, other improvements
* Memoize the select options
* Add missing doc blocks
* JS linting cleanup
Props vedjain, coreymckrill</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontrolsjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersindexjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/index.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersinspectorcontrolsjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersspeakersselectjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerstoolbarjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesspeakersphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,26 +1,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * External dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { get } from 'lodash';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { get } from 'lodash';
</ins><span class="cx" style="display: block; padding: 0 10px"> import classnames from 'classnames';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { Disabled } = wp.components;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { Disabled } = wp.components;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { Component, Fragment } = wp.element;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { __, _n } = wp.i18n;
-const { escapeAttribute } = wp.escapeHtml;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { __, _n } = wp.i18n;
+const { escapeAttribute } = wp.escapeHtml;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { AvatarImage } from '../shared/avatar';
-import { ItemTitle, ItemHTMLContent, ItemPermalink } from '../shared/block-content';
-import { tokenSplit, arrayTokenReplace } from '../shared/i18n';
-import GridContentLayout from '../shared/grid-layout/block-content';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { AvatarImage } from '../shared/avatar';
+import { ItemTitle, ItemHTMLContent, ItemPermalink, BlockNoContent } from '../shared/block-content';
+import { tokenSplit, arrayTokenReplace } from '../shared/i18n';
+import GridContentLayout from '../shared/grid-layout/block-content';
+import { filterEntities } from '../blocks-store';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> import './block-content.scss';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for the section of each speaker post that displays information about relevant sessions.
+ *
+ * @param {Object} props {
+ * @type {Object} speaker
+ * @type {Array} tracks
+ * }
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function SpeakerSessions( { speaker, tracks } ) {
</span><span class="cx" style="display: block; padding: 0 10px"> const sessions = get( speaker, '_embedded.sessions', [] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,20 +95,73 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return output;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for displaying the block content.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersBlockContent extends Component {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Run additional operations during component initialization.
+ *
+ * @param {Object} props
+ */
+ constructor( props ) {
+ super( props );
+
+ this.getFilteredPosts = this.getFilteredPosts.bind( this );
+ }
+
+ /**
+ * Filter and sort the content that will be rendered.
+ *
+ * @returns {Array}
+ */
+ getFilteredPosts() {
+ const { attributes, entities } = this.props;
+ const { wcb_speaker: posts } = entities;
+ const { mode, item_ids, sort } = attributes;
+
+ const args = {};
+
+ if ( Array.isArray( item_ids ) && item_ids.length > 0 ) {
+ args.filter = [
+ {
+ fieldName : mode === 'wcb_speaker' ? 'id' : 'speaker_group',
+ fieldValue : item_ids,
+ },
+ ];
+ }
+
+ args.sort = sort;
+
+ return filterEntities( posts, args );
+ }
+
+ /**
+ * Render the block content.
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { attributes, speakerPosts, tracks } = this.props;
- const {
- show_avatars, avatar_size, avatar_align,
- content, show_session,
- } = attributes;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { attributes, entities } = this.props;
+ const { wcb_track: tracks } = entities;
+ const { show_avatars, avatar_size, avatar_align, content, show_session } = attributes;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const posts = this.getFilteredPosts();
+ const isLoading = ! Array.isArray( posts );
+ const hasPosts = ! isLoading && posts.length > 0;
+
+ if ( isLoading || ! hasPosts ) {
+ return (
+ <BlockNoContent loading={ isLoading } />
+ );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return (
</span><span class="cx" style="display: block; padding: 0 10px"> <GridContentLayout
</span><span class="cx" style="display: block; padding: 0 10px"> className="wordcamp-speakers-block"
</span><span class="cx" style="display: block; padding: 0 10px"> { ...this.props }
</span><span class="cx" style="display: block; padding: 0 10px"> >
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { speakerPosts.map( ( post ) =>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ { posts.map( ( post ) =>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div
</span><span class="cx" style="display: block; padding: 0 10px"> key={ post.slug }
</span><span class="cx" style="display: block; padding: 0 10px"> className={ classnames(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -141,7 +206,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> linkText={ __( 'Visit speaker page', 'wordcamporg' ) }
</span><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </div>,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ </div>
</ins><span class="cx" style="display: block; padding: 0 10px"> ) }
</span><span class="cx" style="display: block; padding: 0 10px"> </GridContentLayout>
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,33 +7,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const { Button, Placeholder } = wp.components;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { __ } = wp.i18n;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { __ } = wp.i18n;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { BlockControls, PlaceholderNoContent, PlaceholderSpecificMode } from '../shared/block-controls';
-import SpeakersBlockContent from './block-content';
-import SpeakersSelect from './speakers-select';
-import { LABEL } from './index';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { BlockControls, PlaceholderSpecificMode } from '../shared/block-controls';
+import SpeakersBlockContent from './block-content';
+import SpeakersSelect from './speakers-select';
+import { LABEL } from './index';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for displaying a UI within the block.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersBlockControls extends BlockControls {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Render the internal block UI.
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { icon, attributes, setAttributes, speakerPosts } = this.props;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { icon, attributes, setAttributes } = this.props;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { mode } = attributes;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const hasPosts = Array.isArray( speakerPosts ) && speakerPosts.length;
-
- if ( mode && ! hasPosts ) {
- return (
- <PlaceholderNoContent
- icon={ icon }
- label={ LABEL }
- loading={ ! Array.isArray( speakerPosts ) }
- />
- );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> let output;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( mode ) {
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,62 +1,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * External dependencies
- */
-import { isUndefined, pickBy, split } from 'lodash';
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const apiFetch = wp.apiFetch;
</del><span class="cx" style="display: block; padding: 0 10px"> const { withSelect } = wp.data;
</span><span class="cx" style="display: block; padding: 0 10px"> const { Component, Fragment } = wp.element;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { addQueryArgs } = wp.url;
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import SpeakersBlockControls from './block-controls';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import SpeakersBlockControls from './block-controls';
</ins><span class="cx" style="display: block; padding: 0 10px"> import SpeakersInspectorControls from './inspector-controls';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import SpeakersToolbar from './toolbar';
-import { ICON } from './index';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import SpeakersToolbar from './toolbar';
+import { ICON } from './index';
+import { WC_BLOCKS_STORE } from '../blocks-store';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const blockData = window.WordCampBlocks.speakers || {};
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const MAX_POSTS = 100;
-
-const ALL_POSTS_QUERY = {
- orderby : 'title',
- order : 'asc',
- per_page : MAX_POSTS,
- _embed : true,
-};
-
-const ALL_TERMS_QUERY = {
- orderby : 'name',
- order : 'asc',
- per_page : MAX_POSTS,
-};
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Top-level component for the editing UI for the block.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersEdit extends Component {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- constructor( props ) {
- super( props );
-
- this.fetchSpeakers();
- }
-
- fetchSpeakers() {
- const allSpeakerPosts = apiFetch( {
- path: addQueryArgs( `/wp/v2/speakers`, ALL_POSTS_QUERY ),
- } );
- const allSpeakerTerms = apiFetch( {
- path: addQueryArgs( `/wp/v2/speaker_group`, ALL_TERMS_QUERY ),
- } );
-
- this.state = {
- allSpeakerPosts : allSpeakerPosts, // Promise
- allSpeakerTerms : allSpeakerTerms, // Promise
- }
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Render the block's editing UI.
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><span class="cx" style="display: block; padding: 0 10px"> const { mode } = this.props.attributes;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,7 +32,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <SpeakersBlockControls
</span><span class="cx" style="display: block; padding: 0 10px"> icon={ ICON }
</span><span class="cx" style="display: block; padding: 0 10px"> { ...this.props }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { ...this.state }
</del><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> { mode &&
</span><span class="cx" style="display: block; padding: 0 10px"> <Fragment>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,36 +44,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const speakersSelect = ( select, props ) => {
- const { mode, item_ids, sort } = props.attributes;
- const { getEntityRecords } = select( 'core' );
- const [ orderby, order ] = split( sort, '_', 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const speakersSelect = ( select ) => {
+ const { getEntities } = select( WC_BLOCKS_STORE );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const args = {
- orderby : orderby,
- order : order,
- per_page : MAX_POSTS, // -1 is not allowed for per_page.
- _embed : true,
- context : 'view',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const entities = {
+ wcb_speaker : getEntities( 'postType', 'wcb_speaker', { _embed: true } ),
+ wcb_speaker_group : getEntities( 'taxonomy', 'wcb_speaker_group' ),
+ wcb_track : getEntities( 'taxonomy', 'wcb_track' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( Array.isArray( item_ids ) ) {
- switch ( mode ) {
- case 'wcb_speaker':
- args.include = item_ids;
- break;
- case 'wcb_speaker_group':
- args.speaker_group = item_ids;
- break;
- }
- }
-
- const speakersQuery = pickBy( args, ( value ) => ! isUndefined( value ) );
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- blockData : blockData,
- speakerPosts : getEntityRecords( 'postType', 'wcb_speaker', speakersQuery ),
- tracks : getEntityRecords( 'taxonomy', 'wcb_track', { per_page: MAX_POSTS } ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ blockData,
+ entities,
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersindexjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/index.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/index.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/index.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,7 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> export const ICON = 'megaphone';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const supports = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'align': [ 'wide', 'full' ],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ align: [ 'wide', 'full' ],
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> export const settings = {
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersinspectorcontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,7 +32,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> sort : {},
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for block controls that appear in the Inspector Panel.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakerInspectorControls extends Component {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Render the controls.
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><span class="cx" style="display: block; padding: 0 10px"> const { attributes, setAttributes, blockData } = this.props;
</span><span class="cx" style="display: block; padding: 0 10px"> const { show_avatars, avatar_size, avatar_align, content, show_session, sort } = attributes;
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersspeakersselectjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,130 +1,121 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * External dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { get, includes } from 'lodash';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { every, flatMap, includes } from 'lodash';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { Dashicon } = wp.components;
</del><span class="cx" style="display: block; padding: 0 10px"> const { Component } = wp.element;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { __ } = wp.i18n;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { __ } = wp.i18n;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { AvatarImage } from '../shared/avatar';
-import ItemSelect from '../shared/item-select';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import ItemSelect, { buildOptions, Option } from '../shared/item-select';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for selecting posts/terms for populating the block content.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersSelect extends Component {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Run additional operations during component initialization.
+ *
+ * @param {Object} props
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> constructor( props ) {
</span><span class="cx" style="display: block; padding: 0 10px"> super( props );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.state = {
- wcb_speaker : [],
- wcb_speaker_group : [],
- loading : true,
- };
-
- this.buildSelectOptions = this.buildSelectOptions.bind( this );
- this.fetchSelectOptions( props );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.buildSelectOptions = this.buildSelectOptions.bind( this );
+ this.getCurrentSelectValue = this.getCurrentSelectValue.bind( this );
+ this.isLoading = this.isLoading.bind( this );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fetchSelectOptions( props ) {
- const { allSpeakerPosts, allSpeakerTerms } = props;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Build or retrieve the options that will populate the Select dropdown.
+ *
+ * @return {Array}
+ */
+ buildSelectOptions() {
+ const { entities } = this.props;
+ const { wcb_speaker, wcb_speaker_group } = entities;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const parsedPosts = allSpeakerPosts.then(
- ( fetchedPosts ) => {
- const posts = fetchedPosts.map( ( post ) => {
- return {
- label : post.title.rendered.trim() || __( '(Untitled)', 'wordcamporg' ),
- value : post.id,
- type : 'wcb_speaker',
- avatar : post.avatar_urls[ '24' ],
- };
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const optionGroups = [
+ {
+ entityType : 'post',
+ type : 'wcb_speaker',
+ label : __( 'Speakers', 'wordcamporg' ),
+ items : wcb_speaker,
+ },
+ {
+ entityType : 'term',
+ type : 'wcb_speaker_group',
+ label : __( 'Groups', 'wordcamporg' ),
+ items : wcb_speaker_group,
+ },
+ ];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.setState( { wcb_speaker: posts } );
- }
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return buildOptions( optionGroups );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const parsedTerms = allSpeakerTerms.then(
- ( fetchedTerms ) => {
- const terms = fetchedTerms.map( ( term ) => {
- return {
- label : term.name || __( '(Untitled)', 'wordcamporg' ),
- value : term.id,
- type : 'wcb_speaker_group',
- count : term.count,
- };
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Determine the currently selected options in the Select dropdown based on block attributes.
+ *
+ * @return {Array}
+ */
+ getCurrentSelectValue() {
+ const { attributes } = this.props;
+ const { mode, item_ids } = attributes;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.setState( { wcb_speaker_group: terms } );
- }
- );
-
- Promise.all( [ parsedPosts, parsedTerms ] ).then( () => {
- this.setState( { loading: false } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const options = flatMap( this.buildSelectOptions(), ( group ) => {
+ return group.options;
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- buildSelectOptions( mode ) {
- const { getOwnPropertyDescriptors } = Object;
- const options = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ let value = [];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const labels = {
- wcb_speaker : __( 'Speakers', 'wordcamporg' ),
- wcb_speaker_group : __( 'Groups', 'wordcamporg' ),
- };
-
- for ( const type in getOwnPropertyDescriptors( this.state ) ) {
- if ( ( ! mode || type === mode ) && this.state[ type ].length ) {
- options.push( {
- label : labels[ type ],
- options : this.state[ type ],
- } );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( mode && item_ids.length ) {
+ value = options.filter( ( option ) => {
+ return mode === option.type && includes( item_ids, option.value );
+ } );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return options;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- render() {
- const { label, icon, attributes, setAttributes } = this.props;
- const { mode, item_ids } = attributes;
- const options = this.buildSelectOptions( mode );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Check if all of the entity groups have finished loading.
+ *
+ * @return {boolean}
+ */
+ isLoading() {
+ const { entities } = this.props;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- let value = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ! every( entities, ( value ) => {
+ return Array.isArray( value );
+ } );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( mode && item_ids.length ) {
- const modeOptions = get( options, '[0].options', [] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Render an ItemSelect component with block-specific settings.
+ *
+ * @return {Element}
+ */
+ render() {
+ const { label, icon, setAttributes } = this.props;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- value = modeOptions.filter( ( option ) => {
- return includes( item_ids, option.value );
- } );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> return (
</span><span class="cx" style="display: block; padding: 0 10px"> <ItemSelect
</span><span class="cx" style="display: block; padding: 0 10px"> className="wordcamp-speakers-select"
</span><span class="cx" style="display: block; padding: 0 10px"> label={ label }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- value={ value }
- buildSelectOptions={ this.buildSelectOptions }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value={ this.getCurrentSelectValue() }
</ins><span class="cx" style="display: block; padding: 0 10px"> onChange={ ( changed ) => setAttributes( changed ) }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- mode={ mode }
</del><span class="cx" style="display: block; padding: 0 10px"> selectProps={ {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isLoading : this.state.loading,
- formatGroupLabel : ( groupData ) => {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ options : this.buildSelectOptions(),
+ isLoading : this.isLoading(),
+ formatOptionLabel : ( optionData ) => {
</ins><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span className="wordcamp-item-select-option-group-label">
- { groupData.label }
- </span>
- );
- },
- formatOptionLabel: ( optionData ) => {
- return (
- <SpeakersOption
- icon={ icon }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <Option
+ icon={ 'wcb_speaker_group' === optionData.type ? icon : null }
</ins><span class="cx" style="display: block; padding: 0 10px"> { ...optionData }
</span><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,53 +126,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function SpeakersOption( { type, icon, label = '', avatar = '', count = 0 } ) {
- let image, content;
-
- switch ( type ) {
- case 'wcb_speaker' :
- image = (
- <AvatarImage
- className="wordcamp-item-select-option-avatar"
- name={ label }
- size={ 24 }
- url={ avatar }
- />
- );
- content = (
- <span className="wordcamp-item-select-option-label">
- { label }
- </span>
- );
- break;
-
- case 'wcb_speaker_group' :
- image = (
- <div className="wordcamp-item-select-option-icon-container">
- <Dashicon
- className="wordcamp-item-select-option-icon"
- icon={ icon }
- size={ 16 }
- />
- </div>
- );
- content = (
- <span className="wordcamp-item-select-option-label">
- { label }
- <span className="wordcamp-item-select-option-label-term-count">
- { count }
- </span>
- </span>
- );
- break;
- }
-
- return (
- <div className="wordcamp-item-select-option">
- { image }
- { content }
- </div>
- );
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> export default SpeakersSelect;
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerstoolbarjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,7 +5,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> const { BlockControls } = wp.editor;
</span><span class="cx" style="display: block; padding: 0 10px"> const { Component } = wp.element;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Component for adding UI buttons to the top of the block.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersToolbar extends Component {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Render the toolbar.
+ *
+ * @return {Element}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><span class="cx" style="display: block; padding: 0 10px"> const { attributes, setAttributes, blockData } = this.props;
</span><span class="cx" style="display: block; padding: 0 10px"> const { layout } = attributes;
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesspeakersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php 2019-05-01 22:10:19 UTC (rev 8711)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php 2019-05-01 22:11:33 UTC (rev 8712)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,6 +94,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_speaker_posts( array $attributes ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $attributes['mode'] ) ) {
+ return [];
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_args = [
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_type' => 'wcb_speaker',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_status' => 'publish',
</span></span></pre>
</div>
</div>
</body>
</html>