Created
November 14, 2020 09:51
-
-
Save Oleksii909/8d2767d71c379583a8343f1168476921 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$js_match_field_element_attributes = <<<JS | |
function () { | |
var expectations = $expected_field_attributes_json; | |
var entityCollection = Drupal.quickedit.collections.entities; | |
var entityModel = entityCollection.get('$entity_page_id'); | |
return entityModel.get('fields').reduce(function (result, fieldModel) { | |
var fieldID = fieldModel.get('fieldID'); | |
var element = fieldModel.get('el'); | |
var matches = element.webkitMatchesSelector(expectations[fieldID]); | |
result[fieldID] = matches ? matches : element.outerHTML; | |
return result; | |
}, {}); | |
}() | |
JS; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment