kylephillips / favorites

Simple and flexible favorite buttons for any WordPress post type.
https://favoriteposts.com
223 stars 86 forks source link

Fix Duplicate ul container $this->list_options->wrapper_type on FavoriteListTypeBase -> noFavorites function #163

Open cicoph opened 2 years ago

cicoph commented 2 years ago
protected function listOpening()
    {
        $css = apply_filters('favorites/list/wrapper/css', $this->list_options->wrapper_css, $this->list_options);
        $out = '<' . $this->list_options->wrapper_type;
        $out .= ' class="favorites-list ' . $css . '" data-userid="' . $this->list_options->user_id . '" data-siteid="' . $this->list_options->site_id . '" ';
        $out .= ( $this->list_options->include_button ) ? 'data-includebuttons="true"' : 'data-includebuttons="false"';
        $out .= ( $this->list_options->include_links ) ? ' data-includelinks="true"' : ' data-includelinks="false"';
        $out .= ( $this->list_options->include_thumbnails ) ? ' data-includethumbnails="true"' : ' data-includethumbnails="false"';
        $out .= ( $this->list_options->include_excerpt ) ? ' data-includeexcerpts="true"' : ' data-includeexcerpts="false"';
        $out .= ' data-thumbnailsize="' . $this->list_options->thumbnail_size . '"';
        $out .= ' data-nofavoritestext="' . $this->list_options->no_favorites . '"';
        $out .= ' data-posttypes="' . $this->list_options->post_types . '"';
        $out .= '>';
        return $out;
    }
protected function listClosing()
    {
        return '</' . $this->list_options->wrapper_type . '>';
    }
protected function noFavorites()
    {

        if ( !empty($this->favorites) ) return;
        // $out = $this->listOpening(); This have $out = '<' . $this->list_options->wrapper_type; 
        $out = '<' . $this->list_options->wrapper_type;
        $out .= ' data-postid="0" data-nofavorites class="no-favorites">' . $this->list_options->no_favorites;
        $out .= '</' . $this->list_options->wrapper_type . '>';
        // $out .= $this->listClosing(); This have return '</' . $this->list_options->wrapper_type . '>';
        return $out;
    }