public function maybeImplode( array $attributes, $implode = true )
	{
		if( !$implode || $implode !== 'implode' ) {
			return $attributes;
		}
		$results = [];
		foreach( $attributes as $key => $value ) {
			// if data attributes, use single quotes in case of json encoded values
			$quotes = false !== stripos( $key, 'data-' ) ? "'" : '"';
			if( is_array( $value )) {
				$value = json_encode( $value );
				$quotes = "'";
			}
			$results[] = is_string( $key )
				? sprintf( '%1$s=%3$s%2$s%3$s', $key, $value, $quotes )
				: $value;
		}
		return implode( ' ', $results );
	}