<!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>[8624] sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks: WordCamp Blocks: Add shared definitions</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/8624">8624</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/8624","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-04-10 23:38:53 +0000 (Wed, 10 Apr 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: Add shared definitions
Many of our blocks share several attribute definitions in their schemas, as
well as several sets of option label/value pairs. This provides a centralized
way to load those definitions to make our codebase DRYer, while still allowing
the flexibility for blocks to define their own attributes/options, and even
modify the shared definitions after loading them.
* Adds new PHP methods for declaring and loading shared attribute/option
definitions.
* Refactors Speakers, Sessions, and Organizers blocks to use these shared
definitions.
* Sponsors block is not refactored as part of this commit because there are
significant differences in its codebase and it will require a larger effort
that may be better as its own commit.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcorganizersinspectorcontrolsjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/organizers/inspector-controls.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_htmlwpcontentmupluginsblocksblocksphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/blocks.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesorganizersphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/organizers.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludessessionsphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/sessions.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesspeakersphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesshareddefinitionsphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/shared/definitions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcorganizersinspectorcontrolsjs"></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/organizers/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/organizers/inspector-controls.js 2019-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/organizers/inspector-controls.js 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,7 +74,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> label={ __( 'Alignment', 'wordcamporg' ) }
</span><span class="cx" style="display: block; padding: 0 10px"> value={ avatar_align }
</span><span class="cx" style="display: block; padding: 0 10px"> onChange={ ( value ) => setAttributes( { avatar_align: value } ) }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- alignOptions={ options.align }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ alignOptions={ options.align_image }
</ins><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> </PanelRow>
</span><span class="cx" style="display: block; padding: 0 10px"> </Fragment>
</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-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,9 +27,9 @@
</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"> const DEFAULT_OPTIONS = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- align : {},
- content : {},
- sort : {},
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ align_image : {},
+ content : {},
+ sort : {},
</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"> class SpeakerInspectorControls extends Component {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -70,7 +70,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> label={ __( 'Alignment', 'wordcamporg' ) }
</span><span class="cx" style="display: block; padding: 0 10px"> value={ avatar_align }
</span><span class="cx" style="display: block; padding: 0 10px"> onChange={ ( value ) => setAttributes( { avatar_align: value } ) }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- alignOptions={ options.align }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ alignOptions={ options.align_image }
</ins><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> </PanelRow>
</span><span class="cx" style="display: block; padding: 0 10px"> </Fragment>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksblocksphp"></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/blocks.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/blocks.php 2019-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/blocks.php 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function load() {
</span><span class="cx" style="display: block; padding: 0 10px"> require_once PLUGIN_DIR . 'includes/shared/grid-layout.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once PLUGIN_DIR . 'includes/shared/featured-image.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ require_once PLUGIN_DIR . 'includes/shared/definitions.php';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once PLUGIN_DIR . 'includes/shared.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once PLUGIN_DIR . 'includes/organizers.php';
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesorganizersphp"></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/organizers.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/organizers.php 2019-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/organizers.php 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Blocks\Organizers;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordCamp\Blocks;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use function WordCamp\Blocks\Shared\Definitions\{ get_shared_definitions, get_shared_definition };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) || die();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -124,68 +125,42 @@
</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_attributes_schema() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
- 'mode' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
- 'default' => '',
- ],
- 'item_ids' => [
- 'type' => 'array',
- 'default' => [],
- 'items' => [
- 'type' => 'integer',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $schema = array_merge(
+ get_shared_definitions(
+ [
+ 'content',
+ 'grid_columns',
+ 'item_ids',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ],
- 'sort' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
- 'default' => 'title_asc',
- ],
- 'layout' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'display' ), 'value' ),
- 'default' => 'list',
- ],
- 'grid_columns' => [
- 'type' => 'integer',
- 'minimum' => 2,
- 'maximum' => 4,
- 'default' => 2,
- ],
- 'className' => [
- 'type' => 'string',
- 'default' => '',
- ],
- 'show_avatars' => [
- 'type' => 'bool',
- 'default' => true,
- ],
- 'avatar_size' => [
- 'type' => 'integer',
- 'minimum' => 25,
- 'maximum' => 600,
- 'default' => 150,
- ],
- 'avatar_align' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'align' ), 'value' ),
- 'default' => 'none',
- ],
- 'content' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'content' ), 'value' ),
- 'default' => 'full',
- ],
- 'excerpt_more' => [
- 'type' => 'bool',
- 'default' => false,
- ],
- 'show_session' => [
- 'type' => 'bool',
- 'default' => false,
- ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'attribute'
+ ),
+ [
+ 'align' => get_shared_definition( 'align_block', 'attribute' ),
+ 'avatar_align' => get_shared_definition( 'align_image', 'attribute' ),
+ 'avatar_size' => [
+ 'type' => 'integer',
+ 'minimum' => 25,
+ 'maximum' => 600,
+ 'default' => 150,
+ ],
+ 'className' => get_shared_definition( 'string_empty', 'attribute' ),
+ 'excerpt_more' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'mode' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
+ 'default' => '',
+ ],
+ 'show_avatars' => get_shared_definition( 'boolean_true', 'attribute' ),
+ 'sort' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
+ 'default' => 'title_asc',
+ ],
+ ]
+ );
+
+ return $schema;
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,86 +171,41 @@
</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_options( $type = '' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $options = [
- 'align' => [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $options = array_merge(
+ get_shared_definitions(
</ins><span class="cx" style="display: block; padding: 0 10px"> [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'label' => _x( 'None', 'alignment option', 'wordcamporg' ),
- 'value' => 'none',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'align_block',
+ 'align_image',
+ 'content',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'label' => _x( 'Left', 'alignment option', 'wordcamporg' ),
- 'value' => 'left',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'option'
+ ),
+ [
+ 'mode' => [
+ [
+ 'label' => '',
+ 'value' => '',
+ ],
+ [
+ 'label' => _x( 'List all organizers', 'mode option', 'wordcamporg' ),
+ 'value' => 'all',
+ ],
+ [
+ 'label' => _x( 'Choose organizers', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_organizer',
+ ],
+ [
+ 'label' => _x( 'Choose teams', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_organizer_team',
+ ],
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'label' => _x( 'Center', 'alignment option', 'wordcamporg' ),
- 'value' => 'center',
- ],
- [
- 'label' => _x( 'Right', 'alignment option', 'wordcamporg' ),
- 'value' => 'right',
- ],
- ],
- 'content' => [
- [
- 'label' => _x( 'Full', 'content option', 'wordcamporg' ),
- 'value' => 'full',
- ],
- [
- 'label' => _x( 'Excerpt', 'content option', 'wordcamporg' ),
- 'value' => 'excerpt',
- ],
- [
- 'label' => _x( 'None', 'content option', 'wordcamporg' ),
- 'value' => 'none',
- ],
- ],
- 'layout' => [
- [
- 'label' => _x( 'List', 'content option', 'wordcamporg' ),
- 'value' => 'list',
- ],
- [
- 'label' => _x( 'Grid', 'content option', 'wordcamporg' ),
- 'value' => 'grid',
- ],
- ],
- 'mode' => [
- [
- 'label' => '',
- 'value' => '',
- ],
- [
- 'label' => _x( 'List all organizers', 'mode option', 'wordcamporg' ),
- 'value' => 'all',
- ],
- [
- 'label' => _x( 'Choose organizers', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_organizer',
- ],
- [
- 'label' => _x( 'Choose teams', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_organizer_team',
- ],
- ],
- 'sort' => [
- [
- 'label' => _x( 'A → Z', 'sort option', 'wordcamporg' ),
- 'value' => 'title_asc',
- ],
- [
- 'label' => _x( 'Z → A', 'sort option', 'wordcamporg' ),
- 'value' => 'title_desc',
- ],
- [
- 'label' => _x( 'Newest to Oldest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_desc',
- ],
- [
- 'label' => _x( 'Oldest to Newest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_asc',
- ],
- ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'sort' => array_merge(
+ get_shared_definition( 'sort_title', 'option' ),
+ get_shared_definition( 'sort_date', 'option' )
+ ),
+ ]
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return empty( $options[ $type ] ) ? [] : $options[ $type ];
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludessessionsphp"></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/sessions.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/sessions.php 2019-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/sessions.php 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,6 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Blocks\Sessions;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordCamp\Blocks;
</span><span class="cx" style="display: block; padding: 0 10px"> use function WordCamp\Blocks\Shared\Components\{ render_grid_layout };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use function WordCamp\Blocks\Shared\Definitions\{ get_shared_definitions, get_shared_definition };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) || die();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,99 +97,48 @@
</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_attributes_schema() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
- 'mode' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
- 'default' => '',
- ],
-
- 'item_ids' => [
- 'type' => 'array',
- 'default' => [],
- 'items' => [
- 'type' => 'integer',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $schema = array_merge(
+ get_shared_definitions(
+ [
+ 'content',
+ 'grid_columns',
+ 'item_ids',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ],
-
- 'sort' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
- 'default' => 'session_time',
- ],
-
- 'className' => [
- 'type' => 'string',
- 'default' => '',
- ],
-
- 'show_speaker' => [
- 'type' => 'bool',
- 'default' => false,
- ],
-
- 'show_images' => [
- 'type' => 'bool',
- 'default' => true,
- ],
-
- 'image_size' => [
- 'type' => 'integer',
- 'minimum' => 25,
- 'maximum' => 600,
- 'default' => 150,
- ],
-
- 'image_align' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'align' ), 'value' ),
- 'default' => 'none',
- ],
-
- 'content' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'content' ), 'value' ),
- 'default' => 'full',
- ],
-
- 'excerpt_more' => [
- 'type' => 'bool',
- 'default' => false,
- ],
-
- 'show_meta' => [
- 'type' => 'bool',
- 'default' => false,
- ],
-
- 'show_category' => [
- 'type' => 'bool',
- 'default' => false,
- ],
-
- 'layout' => [
- 'type' => 'string',
- 'enum' => array( 'list', 'grid' ),
- 'default' => 'list',
- ],
-
- 'grid_columns' => array(
- 'type' => 'integer',
- 'minimum' => 1,
- 'maximum' => 4,
- 'default' => 1,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'attribute'
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ [
+ 'className' => get_shared_definition( 'string_empty', 'attribute' ),
+ 'excerpt_more' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'featured_image_width' => array(
+ 'type' => 'integer',
+ 'default' => 150,
+ ),
+ 'image_align' => get_shared_definition( 'align_image', 'attribute' ),
+ 'image_size' => [
+ 'type' => 'integer',
+ 'minimum' => 25,
+ 'maximum' => 600,
+ 'default' => 150,
+ ],
+ 'mode' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
+ 'default' => '',
+ ],
+ 'show_category' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'show_images' => get_shared_definition( 'boolean_true', 'attribute' ),
+ 'show_meta' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'show_speaker' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'sort' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
+ 'default' => 'session_time',
+ ],
+ ]
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'featured_image_height' => array(
- 'type' => 'integer',
- 'default' => 150,
- ),
-
- 'featured_image_width' => array(
- 'type' => 'integer',
- 'default' => 150,
- ),
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $schema;
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -199,84 +149,51 @@
</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_options( $type = '' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $options = [
- 'align' => [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $options = array_merge(
+ get_shared_definitions(
</ins><span class="cx" style="display: block; padding: 0 10px"> [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'label' => _x( 'None', 'alignment option', 'wordcamporg' ),
- 'value' => 'none',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'align_block',
+ 'align_image',
+ 'content',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'label' => _x( 'Left', 'alignment option', 'wordcamporg' ),
- 'value' => 'left',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'option'
+ ),
+ [
+ 'mode' => [
+ [
+ 'label' => '',
+ 'value' => '',
+ ],
+ [
+ 'label' => _x( 'List all sessions', 'mode option', 'wordcamporg' ),
+ 'value' => 'all',
+ ],
+ [
+ 'label' => _x( 'Choose sessions', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_session',
+ ],
+ [
+ 'label' => _x( 'Choose tracks', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_track',
+ ],
+ [
+ 'label' => _x( 'Choose session categories', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_session_category',
+ ],
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'label' => _x( 'Center', 'alignment option', 'wordcamporg' ),
- 'value' => 'center',
- ],
- [
- 'label' => _x( 'Right', 'alignment option', 'wordcamporg' ),
- 'value' => 'right',
- ],
- ],
- 'content' => [
- [
- 'label' => _x( 'Full', 'content option', 'wordcamporg' ),
- 'value' => 'full',
- ],
- [
- 'label' => _x( 'Excerpt', 'content option', 'wordcamporg' ),
- 'value' => 'excerpt',
- ],
- [
- 'label' => _x( 'None', 'content option', 'wordcamporg' ),
- 'value' => 'none',
- ],
- ],
- 'mode' => [
- [
- 'label' => '',
- 'value' => '',
- ],
- [
- 'label' => _x( 'List all sessions', 'mode option', 'wordcamporg' ),
- 'value' => 'all',
- ],
- [
- 'label' => _x( 'Choose sessions', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_session',
- ],
- [
- 'label' => _x( 'Choose tracks', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_track',
- ],
- [
- 'label' => _x( 'Choose session categories', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_session_category',
- ],
- ],
- 'sort' => [
- [
- 'label' => _x( 'Day and Time', 'sort option', 'wordcamporg' ),
- 'value' => 'session_time',
- ],
- [
- 'label' => _x( 'A → Z', 'sort option', 'wordcamporg' ),
- 'value' => 'title_asc',
- ],
- [
- 'label' => _x( 'Z → A', 'sort option', 'wordcamporg' ),
- 'value' => 'title_desc',
- ],
- [
- 'label' => _x( 'Newest to Oldest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_desc',
- ],
- [
- 'label' => _x( 'Oldest to Newest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_asc',
- ],
- ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'sort' => array_merge(
+ [
+ [
+ 'label' => _x( 'Day and Time', 'sort option', 'wordcamporg' ),
+ 'value' => 'session_time',
+ ],
+ ],
+ get_shared_definition( 'sort_title', 'option' ),
+ get_shared_definition( 'sort_date', 'option' )
+ ),
+ ]
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $options[ $type ] ) ) {
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesshareddefinitionsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/shared/definitions.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/shared/definitions.php (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/shared/definitions.php 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,177 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordCamp\Blocks\Shared\Definitions;
+defined( 'WPINC' ) || die();
+
+/**
+ * Retrieve an array of definitions for use within a block.
+ *
+ * Currently there are two types of definitions: attributes, which make up a block's schema, and options, which
+ * are label/value pairs used in situations where the value of an attribute must come from an enumerated list.
+ *
+ * @param array|string $keys The keys of the definitions to retrieve. An array of strings, or 'all'.
+ * @param string $type The type of definition to retrieve. 'attribute' or 'option'.
+ *
+ * @return array
+ */
+function get_shared_definitions( $keys, $type ) {
+ switch ( $type ) {
+ case 'attribute':
+ $definitions = [
+ // Generic attributes.
+ 'boolean_false' => [
+ 'type' => 'bool',
+ 'default' => false,
+ ],
+ 'boolean_true' => [
+ 'type' => 'bool',
+ 'default' => true,
+ ],
+ 'string_empty' => [
+ 'type' => 'string',
+ 'default' => '',
+ ],
+ // Specific attributes.
+ 'align_block' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_shared_definition( 'align_block', 'option' ), 'value' ),
+ 'default' => '',
+ ],
+ 'align_image' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_shared_definition( 'align_image', 'option' ), 'value' ),
+ 'default' => 'none',
+ ],
+ 'content' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_shared_definition( 'content', 'option' ), 'value' ),
+ 'default' => 'full',
+ ],
+ 'grid_columns' => [
+ 'type' => 'integer',
+ 'minimum' => 2,
+ 'maximum' => 4,
+ 'default' => 2,
+ ],
+ 'item_ids' => [
+ 'type' => 'array',
+ 'default' => [],
+ 'items' => [
+ 'type' => 'integer',
+ ],
+ ],
+ 'layout' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_shared_definition( 'layout', 'option' ), 'value' ),
+ 'default' => 'list',
+ ],
+ ];
+ break;
+
+ case 'option':
+ $definitions = [
+ 'align_block' => [
+ [
+ 'label' => _x( 'Wide', 'alignment option', 'wordcamporg' ),
+ 'value' => 'wide',
+ ],
+ [
+ 'label' => _x( 'Full', 'alignment option', 'wordcamporg' ),
+ 'value' => 'full',
+ ],
+ ],
+ 'align_image' => [
+ [
+ 'label' => _x( 'None', 'alignment option', 'wordcamporg' ),
+ 'value' => 'none',
+ ],
+ [
+ 'label' => _x( 'Left', 'alignment option', 'wordcamporg' ),
+ 'value' => 'left',
+ ],
+ [
+ 'label' => _x( 'Center', 'alignment option', 'wordcamporg' ),
+ 'value' => 'center',
+ ],
+ [
+ 'label' => _x( 'Right', 'alignment option', 'wordcamporg' ),
+ 'value' => 'right',
+ ],
+ ],
+ 'content' => [
+ [
+ 'label' => _x( 'Full', 'content option', 'wordcamporg' ),
+ 'value' => 'full',
+ ],
+ [
+ 'label' => _x( 'Excerpt', 'content option', 'wordcamporg' ),
+ 'value' => 'excerpt',
+ ],
+ [
+ 'label' => _x( 'None', 'content option', 'wordcamporg' ),
+ 'value' => 'none',
+ ],
+ ],
+ 'layout' => [
+ [
+ 'label' => _x( 'List', 'content option', 'wordcamporg' ),
+ 'value' => 'list',
+ ],
+ [
+ 'label' => _x( 'Grid', 'content option', 'wordcamporg' ),
+ 'value' => 'grid',
+ ],
+ ],
+ 'sort_title' => [
+ [
+ 'label' => _x( 'A → Z', 'sort option', 'wordcamporg' ),
+ 'value' => 'title_asc',
+ ],
+ [
+ 'label' => _x( 'Z → A', 'sort option', 'wordcamporg' ),
+ 'value' => 'title_desc',
+ ],
+ ],
+ 'sort_date' => [
+ [
+ 'label' => _x( 'Newest to Oldest', 'sort option', 'wordcamporg' ),
+ 'value' => 'date_desc',
+ ],
+ [
+ 'label' => _x( 'Oldest to Newest', 'sort option', 'wordcamporg' ),
+ 'value' => 'date_asc',
+ ],
+ ],
+ ];
+ break;
+
+ default:
+ $definitions = [];
+ break;
+ }
+
+ if ( 'all' === $keys ) {
+ return $definitions;
+ }
+
+ $keys = array_fill_keys( (array) $keys, '' );
+
+ return array_intersect_key( $definitions, $keys );
+}
+
+/**
+ * Retrieve a single definition for use within a block.
+ *
+ * @param string $key The key of the definition to retrieve.
+ * @param string $type The type of definition to retrieve. 'attribute' or 'option'.
+ *
+ * @return array
+ */
+function get_shared_definition( $key, $type ) {
+ $result = get_shared_definitions( $key, $type );
+
+ if ( ! empty( $result ) ) {
+ $result = array_shift( $result );
+ }
+
+ return $result;
+}
</ins></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-04-10 18:30:47 UTC (rev 8623)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php 2019-04-10 23:38:53 UTC (rev 8624)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Blocks\Speakers;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordCamp\Blocks;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use function WordCamp\Blocks\Shared\Definitions\{ get_shared_definitions, get_shared_definition };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) || die();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -165,68 +166,43 @@
</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_attributes_schema() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return [
- 'mode' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
- 'default' => '',
- ],
- 'item_ids' => [
- 'type' => 'array',
- 'default' => [],
- 'items' => [
- 'type' => 'integer',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $schema = array_merge(
+ get_shared_definitions(
+ [
+ 'content',
+ 'grid_columns',
+ 'item_ids',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ],
- 'sort' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
- 'default' => 'title_asc',
- ],
- 'layout' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'display' ), 'value' ),
- 'default' => 'list',
- ],
- 'grid_columns' => [
- 'type' => 'integer',
- 'minimum' => 2,
- 'maximum' => 4,
- 'default' => 2,
- ],
- 'className' => [
- 'type' => 'string',
- 'default' => '',
- ],
- 'show_avatars' => [
- 'type' => 'bool',
- 'default' => true,
- ],
- 'avatar_size' => [
- 'type' => 'integer',
- 'minimum' => 25,
- 'maximum' => 600,
- 'default' => 150,
- ],
- 'avatar_align' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'align' ), 'value' ),
- 'default' => 'none',
- ],
- 'content' => [
- 'type' => 'string',
- 'enum' => wp_list_pluck( get_options( 'content' ), 'value' ),
- 'default' => 'full',
- ],
- 'excerpt_more' => [
- 'type' => 'bool',
- 'default' => false,
- ],
- 'show_session' => [
- 'type' => 'bool',
- 'default' => false,
- ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'attribute'
+ ),
+ [
+ 'align' => get_shared_definition( 'align_block', 'attribute' ),
+ 'avatar_align' => get_shared_definition( 'align_image', 'attribute' ),
+ 'avatar_size' => [
+ 'type' => 'integer',
+ 'minimum' => 25,
+ 'maximum' => 600,
+ 'default' => 150,
+ ],
+ 'className' => get_shared_definition( 'string_empty', 'attribute' ),
+ 'excerpt_more' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'mode' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
+ 'default' => '',
+ ],
+ 'show_avatars' => get_shared_definition( 'boolean_true', 'attribute' ),
+ 'show_session' => get_shared_definition( 'boolean_false', 'attribute' ),
+ 'sort' => [
+ 'type' => 'string',
+ 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
+ 'default' => 'title_asc',
+ ],
+ ]
+ );
+
+ return $schema;
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -237,86 +213,41 @@
</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_options( $type = '' ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $options = [
- 'align' => [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $options = array_merge(
+ get_shared_definitions(
</ins><span class="cx" style="display: block; padding: 0 10px"> [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'label' => _x( 'None', 'alignment option', 'wordcamporg' ),
- 'value' => 'none',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'align_block',
+ 'align_image',
+ 'content',
+ 'layout',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'label' => _x( 'Left', 'alignment option', 'wordcamporg' ),
- 'value' => 'left',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'option'
+ ),
+ [
+ 'mode' => [
+ [
+ 'label' => '',
+ 'value' => '',
+ ],
+ [
+ 'label' => _x( 'List all speakers', 'mode option', 'wordcamporg' ),
+ 'value' => 'all',
+ ],
+ [
+ 'label' => _x( 'Choose speakers', 'mode option', 'wordcamporg' ),
+ 'value' => 'wcb_speaker',
+ ],
+ [
+ 'label' => _x( 'Choose groups', 'mode option', 'wordcamporg' ),
+ 'value' => '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">- [
- 'label' => _x( 'Center', 'alignment option', 'wordcamporg' ),
- 'value' => 'center',
- ],
- [
- 'label' => _x( 'Right', 'alignment option', 'wordcamporg' ),
- 'value' => 'right',
- ],
- ],
- 'content' => [
- [
- 'label' => _x( 'Full', 'content option', 'wordcamporg' ),
- 'value' => 'full',
- ],
- [
- 'label' => _x( 'Excerpt', 'content option', 'wordcamporg' ),
- 'value' => 'excerpt',
- ],
- [
- 'label' => _x( 'None', 'content option', 'wordcamporg' ),
- 'value' => 'none',
- ],
- ],
- 'layout' => [
- [
- 'label' => _x( 'List', 'content option', 'wordcamporg' ),
- 'value' => 'list',
- ],
- [
- 'label' => _x( 'Grid', 'content option', 'wordcamporg' ),
- 'value' => 'grid',
- ],
- ],
- 'mode' => [
- [
- 'label' => '',
- 'value' => '',
- ],
- [
- 'label' => _x( 'List all speakers', 'mode option', 'wordcamporg' ),
- 'value' => 'all',
- ],
- [
- 'label' => _x( 'Choose speakers', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_speaker',
- ],
- [
- 'label' => _x( 'Choose groups', 'mode option', 'wordcamporg' ),
- 'value' => 'wcb_speaker_group',
- ],
- ],
- 'sort' => [
- [
- 'label' => _x( 'A → Z', 'sort option', 'wordcamporg' ),
- 'value' => 'title_asc',
- ],
- [
- 'label' => _x( 'Z → A', 'sort option', 'wordcamporg' ),
- 'value' => 'title_desc',
- ],
- [
- 'label' => _x( 'Newest to Oldest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_desc',
- ],
- [
- 'label' => _x( 'Oldest to Newest', 'sort option', 'wordcamporg' ),
- 'value' => 'date_asc',
- ],
- ],
- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'sort' => array_merge(
+ get_shared_definition( 'sort_title', 'option' ),
+ get_shared_definition( 'sort_date', 'option' )
+ ),
+ ]
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $options[ $type ] ) ) {
</span></span></pre>
</div>
</div>
</body>
</html>