'fa-facebook', 'twitter' => 'fa-twitter', 'linkedin' => 'fa-linkedin', 'instagram' => 'fa-instagram', ); } /** * Resolves the image URL for a member's `image` attribute value, * falling back to the URL captured at selection time if the attachment * no longer exists. * * @param array $image Item image data: [ 'id' => int, 'url' => string ]. * @param string $size Registered image size name. */ public static function image_url( array $image, string $size = 'large' ): string { if ( ! empty( $image['id'] ) ) { $url = wp_get_attachment_image_url( (int) $image['id'], $size ); if ( $url ) { return $url; } } return $image['url'] ?? ''; } /** * Filters the configured social platforms down to only the ones this * member has a non-empty URL for. */ public static function active_social_links( array $item ): array { $social = is_array( $item['social'] ?? null ) ? $item['social'] : array(); $active = array(); foreach ( self::social_platforms() as $key => $icon_class ) { if ( ! empty( $social[ $key ] ) ) { $active[ $key ] = array( 'url' => $social[ $key ], 'icon' => $icon_class, ); } } return $active; } /** * Skill rows with a valid title, ready to render as percent bars. */ public static function active_skills( array $item ): array { $skills = is_array( $item['skills'] ?? null ) ? $item['skills'] : array(); $active = array(); foreach ( $skills as $skill ) { if ( empty( $skill['title'] ) ) { continue; } $active[] = array( 'title' => $skill['title'], 'value' => max( 0, min( 100, (int) ( $skill['value'] ?? 0 ) ) ), ); } return $active; } /** * Builds the class list for a member's `.cfbk-team-display-wrapper` card, * shared by every template (templates/template-1.php etc.) so the * "no image" reflow class doesn't have to be duplicated in each one. * * @param array $item A single members[] entry. * @param array $extra Extra classes specific to the calling template. */ public static function wrapper_classes( array $item, array $extra = array() ): string { $classes = array_merge( array( 'cfbk-team-display-wrapper', 'cfbk-grid-boxes' ), $extra ); if ( empty( $item['image']['url'] ) && empty( $item['image']['id'] ) ) { $classes[] = 'cfbk-no-img-class'; } return implode( ' ', $classes ); } }