-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use data-hero-candidate attribute in DetermineHeroImages #5934
Merged
westonruter
merged 25 commits into
develop
from
fix/5824-use-data-hero-candidate-attribute
Mar 19, 2021
Merged
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8b84aaa
Switch to data-hero-candidate branch for amp-toolbox
schlessera d727a36
Use data-hero-candidate attribute in DetermineHeroImages transformer
schlessera 77d5f99
Refactor transformer to get rid of code duplication
schlessera c490443
Adapt tests
schlessera 48b9524
Update Composer lock file - 2020-03-08
schlessera b126bc3
Update amp-toolbox-php dependency to v0.2.0
schlessera b685b0e
Use switch instead of variable methods
schlessera 7d96d8a
Improve XPath to target custom header images
schlessera cdaa8c4
Use new Encoding::AMP constant
schlessera 223b008
Ignore PHPStan error for PHP7+ isBuiltIn() method
schlessera 3d6ff8b
Merge branch 'fix/5824-use-data-hero-candidate-attribute' of https://…
schlessera e13d93d
Remove DetermineHeroImages from default transformers
schlessera 1d99a1e
Revert "Ignore PHPStan error for PHP7+ isBuiltIn() method"
schlessera 02d1b90
Use centralized default options for Dom\Document
schlessera 68b961c
Keep matching the custom header class
schlessera 025a6f0
Change the way the amp carousel test is set up
schlessera b5e45f1
Fix assignment alignment for phpcs; add phpdoc type for static analysis
westonruter cadc98f
Fix detecting hero image candidate in Cover Block
westonruter 2cac676
Only consider cover block in initial position of first entry content
westonruter 834cca5
Test detection of cover block inside initial group block
westonruter e42f1b3
Add prerendering for image blocks in initial position if first entry …
westonruter 8513aba
Enable DetermineHeroImages transformer by default in core themes
westonruter 25ec074
Remove obsolete logic for candidates as array
westonruter 65b0e05
Add covers annotations for DetermineHeroImages tests
schlessera bcb50e5
Use constant for config key
schlessera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Class Options. | ||
* | ||
* @package AmpProject\AmpWP | ||
*/ | ||
|
||
namespace AmpProject\AmpWP\Dom; | ||
|
||
use AmpProject\Dom\Document; | ||
|
||
interface Options { | ||
|
||
/** | ||
* Default options to use for the Dom. | ||
* | ||
* @var array | ||
*/ | ||
const DEFAULTS = [ | ||
Document\Option::AMP_BIND_SYNTAX => Document\Option::AMP_BIND_SYNTAX_DATA_ATTRIBUTE, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative way to identify the header image which may be more robust as opposed to relying on element IDs is to obtain the header image URL and then query for image elements that have that
src
:But this is going to have other problems, namely because
get_header_image_tag()
allows for the markup to be filtered, meaning the image URL could be replaced with one that is pointing to a CDN.