Skip to content

Commit

Permalink
Block makes use of event Sched ID
Browse files Browse the repository at this point in the history
Signed-off-by: James Hunt <10615884+thetwopct@users.noreply.github.com>
  • Loading branch information
thetwopct committed Aug 30, 2024
1 parent c07e463 commit 3123956
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ function ( $speaker ) {
$attributes['speakers']
);

$sched_event_id = $attributes['schedEventID'] ?? '';
global $post;
$sched_event_id = null;
if (function_exists('lfe_get_event_parent_id')) {
$parent_id = lfe_get_event_parent_id( $post );
$sched_event_id = get_post_meta( $parent_id, 'lfes_sched_event_id', true );
}

$speakers_query = new WP_Query(
array(
Expand Down
3 changes: 0 additions & 3 deletions web/wp-content/plugins/speakers-block-2/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"speakers": {
"type": "array",
"default": []
},
"schedEventID": {
"type": "string"
}
},
"textdomain": "speakers-block-2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-blocks', 'wp-components'), 'version' => '3158526a5552f3f9ce81');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-blocks'), 'version' => '19787af58ebe2e768e3b');
2 changes: 1 addition & 1 deletion web/wp-content/plugins/speakers-block-2/build/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @since 0.3.0
*/

global $wp;
global $post;
$speaker_id = get_the_ID();
$speaker_slug = $post->post_name;
Expand Down
19 changes: 1 addition & 18 deletions web/wp-content/plugins/speakers-block-2/src/edit.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import {
useBlockProps,
InspectorControls,
} from '@wordpress/block-editor';

import {
PanelBody,
TextControl,
} from '@wordpress/components';

const { apiFetch } = wp;

import React, { MouseEventHandler, useCallback, useState } from 'react';
Expand Down Expand Up @@ -93,7 +87,7 @@ const loadOptions = debounce(
);

export default function Edit( { attributes, setAttributes } ) {
const { speakers, schedEventID } = attributes;
const { speakers } = attributes;

const [selected, setSelected] = useState(speakers);

Expand Down Expand Up @@ -124,17 +118,6 @@ export default function Edit( { attributes, setAttributes } ) {
}, [setSelected]);

return [
<InspectorControls key="speakers-block-panel">
<PanelBody title="Settings" initialOpen={ true }>
<TextControl
label="Sched Event ID"
value={ schedEventID }
onChange={ ( value ) =>
setAttributes( { schedEventID: value } )
}
/>
</PanelBody>
</InspectorControls>,
<div { ...useBlockProps() } key="speakers-block-edit">
<p>
<strong>Featured Speakers (each opens with modal):</strong>
Expand Down

0 comments on commit 3123956

Please sign in to comment.