Making WordPress.org


Ignore:
Timestamp:
08/13/2020 11:43:14 PM (4 years ago)
Author:
coreymckrill
Message:

WordPress.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/1accd3db38a60230689bdc157f9e82081d35d163...38e7793fd20434d72ca898988d017ba2009fb677

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/blocks.php

    r10147 r10169  
    1212 *
    1313 * @see https://developer.wordpress.org/block-editor/tutorials/block-tutorial/applying-styles-with-stylesheets/
     14 * @throws Error If the build files are not found.
    1415 */
    1516function workshop_details_init() {
     
    2324    }
    2425
    25     $script_asset = require( $script_asset_path );
     26    $script_asset = require $script_asset_path;
    2627    wp_register_script(
    2728        'workshop-details-editor-script',
     
    5152        'editor_style'    => 'workshop-details-editor-style',
    5253        'style'           => 'workshop-details-style',
    53         'render_callback' => __NAMESPACE__ . '\workshop_details_render_callback'
     54        'render_callback' => __NAMESPACE__ . '\workshop_details_render_callback',
    5455    ) );
    5556}
    56 
    57 
    5857
    5958/**
    6059 * Build the html output based on input fields
    6160 *
    62  * @param array   $fields
     61 * @param array $fields
    6362 * @return string HTML output.
    6463 */
     
    6665    $output = '<ul class="wp-block-wporg-learn-workshop-details">';
    6766
    68     foreach( $fields as $key => $value ) {
     67    foreach ( $fields as $key => $value ) {
    6968        $output .= sprintf( '<li><b>%1$s</b><span>%2$s</span></li>', $key, $value );
    7069    }
     
    8382 */
    8483function workshop_details_render_callback( $attributes, $content ) {
    85     $post = get_post();
    86     $topics = wp_get_post_terms( $post->ID, 'topic', array( 'fields' => 'names' ) );
    87     $level = wp_get_post_terms( $post->ID, 'level', array( 'fields' => 'names' ) );
     84    $post     = get_post();
     85    $topics   = wp_get_post_terms( $post->ID, 'topic', array( 'fields' => 'names' ) );
     86    $level    = wp_get_post_terms( $post->ID, 'level', array( 'fields' => 'names' ) );
    8887    $captions = get_post_meta( $post->ID, 'video_caption_language' );
    8988
    9089    $fields = array(
    91         __( 'Length' , 'wporg-learn') => get_workshop_duration( $post, 'string' ),
    92         __( 'Topic' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $topics ) ),
    93         __( 'Level' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $level ) ),
    94         __( 'Language' , 'wporg-learn') => esc_html( $post->video_language ),
    95         __( 'Captions' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $captions ) ),
     90        __( 'Length', 'wporg-learn' )  => get_workshop_duration( $post, 'string' ),
     91        __( 'Topic', 'wporg-learn' )    => implode( ', ', array_map( 'esc_html', $topics ) ),
     92        __( 'Level', 'wporg-learn' )    => implode( ', ', array_map( 'esc_html', $level ) ),
     93        __( 'Language', 'wporg-learn' ) => esc_html( $post->video_language ),
     94        __( 'Captions', 'wporg-learn' ) => implode( ', ', array_map( 'esc_html', $captions ) ),
    9695    );
    9796
    98     // Remove empty fields
     97    // Remove empty fields.
    9998    $fields_to_output = array_filter( $fields );
    10099
     
    104103/**
    105104 * Enqueue scripts and stylesheets for custom block styles.
     105 *
     106 * @throws Error If the build files are not found.
    106107 */
    107108function enqueue_block_style_assets() {
     
    116117        }
    117118
    118         $script_asset = require( $script_asset_path );
     119        $script_asset = require $script_asset_path;
    119120        wp_enqueue_script(
    120121            'wporg-learn-block-styles',
Note: See TracChangeset for help on using the changeset viewer.