rep__listing_documents_html( $value )

This function takes the value of a data field and generates the HTML markupĀ  to display the value as a document list.

Namespace

REP_Malcolm

Parameters

$value

string

The value to be rendered as a document list

Return

string

The HTML markup for displaying a document list

Source

File: \includes\rep-helper-functions.php

function rep__listing_documents_html($value){
    $value = unserialize($value);
    $links = [];

    /**
     * Filters: rep__listing_documents_text_src.
     * 
     * Allow filtering the text source to be used on rendering listing documents
     *
     * @since   1.6.19
     * @param   string $text_src    Listing documents arguments source. Default is 'type'. Options are 'type', 'url', and 'title'
     * @return  string              Filtered text source argument.
     */
    $text_src = apply_filters( "rep__listing_documents_text_src", "type" );

    if(!empty($value)): 
        foreach($value as $val): 

            $display_text = lp__array_key_value( $text_src, $val );

            if( ! $display_text && $text_src != 'title' ) $display_text = lp__array_key_value( 'title', $val );

            $links[] = array( 
                'link' => lp__array_key_value('url', $val), 

                /**
                 * Filters: rep__listing_documents_display_text.
                 * 
                 * Allow filtering the display text for listing documents
                 *
                 * @since   1.6.19
                 * @param   string $text    Listing document display text
                 * @param   array $val      Listing document arguments
                 * @return  string          Filtered display text.
                 */
                'text' => apply_filters( "rep__listing_documents_display_text", $display_text, $val ) 
            );

        endforeach; 
    endif;

    return lp__data_list_html( $links, array( 'el_classes' => 'rep-documents', 'child_el_classes' => 'rep-document' ) );
}