$name = Array_Helper::ensure_array( $value ); break; case 'tags': if ( ! is_array( $value ) ) $value = array(); $this->$name = $value; break; default: parent::__set( $name, $value ); } } protected function tags() { $tags = $this->tags; $supported_types = $this->supported_types; if ( is_null( $supported_types ) || in_array( '*', $supported_types ) ) return $tags; $filtered_tags = array(); foreach ( $tags as $tag ) { if ( ! in_array( $tag['basetype'], $supported_types ) ) continue ; $filtered_tags[] = $tag; } return $filtered_tags; } public function output() { $output = parent::output(); $tags = $this->tags(); $id = $this->get_id(); $tags_output = array(); $tags_output[] = '
'; foreach ( $tags as $tag ) { $tag_name = $tag['name']; if ( empty( $tag_name ) ) continue ; $tag_formatted = '[' . $tag['name'] . ']'; $tags_output[] = sprintf( '%2$s', esc_attr( $tag_formatted ), $tag_formatted, esc_attr( '#' . $id ) ); } $tags_output[] = '
'; return $output . implode( $tags_output ); } }