File tree Expand file tree Collapse file tree 9 files changed +17
-12
lines changed
Expand file tree Collapse file tree 9 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## v1.2.1
8+
9+ - Fix ` optional() ` references previously supplied by ` illuminate/support ` .
10+
711## v1.2.0
812
9- Dependency update, deprecation notice.
13+ - Remove illuminate/support dependency.
14+ - Dependency update, deprecation notice.
1015
1116## v1.1.1
1217
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function render(): void {
2929 }
3030
3131 // Attributes from the audio element for loop/controls/autoplay/etc.
32- foreach ( optional ( $ audio ) ->getAttributes () ?? [] as $ attr => $ value ) {
32+ foreach ( $ audio? ->getAttributes() ?? [] as $ attr => $ value ) {
3333 $ this ->attrs [ $ attr ] = $ value ?? true ;
3434 }
3535
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function render(): void {
2727 $ this ->attrs [ $ attr ] = $ value ;
2828 }
2929
30- foreach ( optional ( $ link ) ->getAttributes () ?? [] as $ attr => $ value ) {
30+ foreach ( $ link? ->getAttributes() ?? [] as $ attr => $ value ) {
3131 $ this ->attrs ['linkAttributes ' ][ $ attr ] = $ value ;
3232 }
3333
@@ -36,7 +36,7 @@ public function render(): void {
3636 $ this ->attrs ['link ' ] = $ this ->attrs ['linkAttributes ' ]['href ' ] ?? '' ;
3737 unset( $ this ->attrs ['linkAttributes ' ]['href ' ] );
3838
39- $ this ->attrs ['content ' ] = optional ( $ link ) ->innerHtml () ?? '' ;
39+ $ this ->attrs ['content ' ] = $ link? ->innerHtml() ?? '' ;
4040
4141 $ this ->render_component ( $ this ->attrs );
4242 }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function render(): void {
2727 }
2828
2929 $ this ->attrs ['items ' ] = $ this ->attrs ['ids ' ];
30- $ this ->attrs ['caption ' ] = optional ( $ root ->find ( '.blocks-gallery-caption ' , 0 ) ) ->innerHtml () ?? '' ;
30+ $ this ->attrs ['caption ' ] = $ root ->find ( '.blocks-gallery-caption ' , 0 )? ->innerHtml() ?? '' ;
3131
3232 $ this ->render_component ( $ this ->attrs );
3333 }
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function render(): void {
4343 * @return string
4444 */
4545 private function get_link ( string $ fallback = '' ): string {
46- $ maybe_url = optional ( $ this ->dom_parser ->find ( 'a ' , 0 ) ) ->getAttribute ( 'href ' );
46+ $ maybe_url = $ this ->dom_parser ->find ( 'a ' , 0 )? ->getAttribute( 'href ' );
4747 return $ maybe_url ?? $ fallback ;
4848 }
4949
@@ -53,7 +53,7 @@ private function get_link( string $fallback = '' ): string {
5353 * @return string
5454 */
5555 private function get_caption (): string {
56- $ caption = optional ( $ this ->dom_parser ->find ( 'figcaption ' , 0 ) ) ->innerHtml () ?? '' ;
56+ $ caption = $ this ->dom_parser ->find ( 'figcaption ' , 0 )? ->innerHtml() ?? '' ;
5757 return $ caption ;
5858 }
5959}
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ public function render(): void {
2626 $ this ->attrs [ $ attr ] = $ value ;
2727 }
2828
29- $ this ->attrs ['citation ' ] = optional ( $ root ->find ( 'cite ' , 0 ) ) ->innerHtml () ?? '' ;
30- $ this ->attrs ['content ' ] = optional ( $ root ->find ( 'p ' , 0 ) ) ->innerHtml () ?? '' ;
29+ $ this ->attrs ['citation ' ] = $ root ->find ( 'cite ' , 0 )? ->innerHtml() ?? '' ;
30+ $ this ->attrs ['content ' ] = $ root ->find ( 'p ' , 0 )? ->innerHtml() ?? '' ;
3131
3232 $ this ->render_component ( $ this ->attrs );
3333 }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public function render(): void {
3131 $ this ->attrs ['header ' ] = $ this ->extract_header ();
3232 $ this ->attrs ['footer ' ] = $ this ->extract_footer ();
3333 $ this ->attrs ['body ' ] = $ this ->extract_body ();
34- $ this ->attrs ['citation ' ] = optional ( $ this ->root ->find ( 'figcaption ' , 0 ) ) ->innerHtml () ?? '' ;
34+ $ this ->attrs ['citation ' ] = $ this ->root ->find ( 'figcaption ' , 0 )? ->innerHtml() ?? '' ;
3535
3636 $ this ->render_component ( $ this ->attrs );
3737 }
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function render(): void {
2929 }
3030
3131 // Attributes from the Video element for loop/controls/autoplay/etc.
32- foreach ( optional ( $ video ) ->getAttributes () ?? [] as $ attr => $ value ) {
32+ foreach ( $ video? ->getAttributes() ?? [] as $ attr => $ value ) {
3333 $ this ->attrs [ $ attr ] = $ value ?? true ;
3434 }
3535
Original file line number Diff line number Diff line change 1111 * Plugin Name: WP Component Library
1212 * Plugin URI: https://github.com/alleyinteractive/wp-component-library
1313 * Description: Component library functionality for your WordPress theme.
14- * Version: 1.1.0
14+ * Version: 1.2.1
1515 * Author: Alley
1616 */
1717
You can’t perform that action at this time.
0 commit comments