/** * Build the attributes(prop=val) for the gallery anchor elemnt * It may be useful in adding some extra attributes to the anchor * @param type $args * @return string */ function mpp_get_gallery_html_attributes($args = null) { $default = array('class' => '', 'id' => '', 'title' => '', 'data-mpp-context' => 'galery', 'gallery' => 0); $args = wp_parse_args($args, $default); $gallery = mpp_get_gallery($args['gallery']); if (!$gallery) { return ''; } //if(! $args['id'] ) // $args['id'] = 'mpp-gallery-thumbnail-' . $gallery->id; $args['gallery'] = $gallery; //we will pass teh gallery object to the filter too $args = (array) apply_filters('mpp_gallery_html_attributes_pre', $args); unset($args['gallery']); if (empty($args['title'])) { $args['title'] = mpp_get_gallery_title($gallery); } if (!isset($args['data-mpp-gallery-id'])) { $args['data-mpp-gallery-id'] = mpp_get_gallery_id($gallery); } return mpp_get_html_attributes($args); //may be a filter in future here }
/** * Build the attributes(prop=val) for the media anchor elemnt * It may be useful in adding some extra attributes to the anchor * @param type $args * @return string */ function mpp_get_media_html_attributes($args = null) { $default = array('class' => '', 'id' => '', 'title' => '', 'data-mpp-context' => 'gallery', 'media' => 0); $args = wp_parse_args($args, $default); $media = mpp_get_media($args['media']); if (!$media) { return ''; } //if(! $args['id'] ) // $args['id'] = 'mpp-media-thumbnail-' . $gallery->id; $args['media'] = $media; //we will pass the media object to the filter too $args = (array) apply_filters('mpp_media_html_attributes_pre', $args); unset($args['media']); if (empty($args['title'])) { $args['title'] = mpp_get_media_title($media); } return mpp_get_html_attributes($args); //may be a filter in future here }