Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webcomponents
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
webcomponents
Commits
00ee81d7
Commit
00ee81d7
authored
7 years ago
by
🙄 ✻
Browse files
Options
Downloads
Patches
Plain Diff
example alter hook illustrating how to point to a different place for element addition to the page
parent
2d9dfb6c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/webcomponents_app/webcomponents_app.api.php
+13
-0
13 additions, 0 deletions
modules/webcomponents_app/webcomponents_app.api.php
with
13 additions
and
0 deletions
modules/webcomponents_app/webcomponents_app.api.php
+
13
−
0
View file @
00ee81d7
...
...
@@ -114,3 +114,16 @@ function hook_webcomponents_app_deliver_data_alter(&$return, $app) {
$return
[
'detail'
]
=
t
(
'I\'m a little tea pot short and stout'
);
}
}
/**
* Implements hook_webcomponents_app_element_import_alter().
* @param array $link_element an array to be added via drupal_add_html_head
* @param array $app app manifest as loaded by drupal
* @param string $machine_name the name of the app
* @param string $hash hash value based on filesize for easy cache busting
* @see drupal_add_html_head()
*/
function
hook_webcomponents_app_element_import_alter
(
&
$link_element
,
$app
,
$machine_name
,
$hash
)
{
// we don't store our apps in the app path, we only use it for registration
$link_element
[
'#attributes'
][
'href'
]
=
libraries_get_path
(
'webcomponents'
,
TRUE
)
.
'/polymer/apps-src/'
.
$machine_name
.
'/'
.
$machine_name
.
'.html?h'
.
$hash
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment