Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zurb_foundation-3240623
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
zurb_foundation-3240623
Commits
1c5e7d9a
Commit
1c5e7d9a
authored
10 years ago
by
Kevin Quillen
Browse files
Options
Downloads
Patches
Plain Diff
Add theme functions for dropdown and split buttons
parent
d327b9de
No related branches found
Branches containing commit
Tags
7.x-4.0-rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
template.php
+76
-0
76 additions, 0 deletions
template.php
with
76 additions
and
0 deletions
template.php
+
76
−
0
View file @
1c5e7d9a
...
...
@@ -1187,3 +1187,79 @@ function zurb_foundation_process_html_tag(&$vars) {
}
}
}
/**
* Implements theme_links() with foundations dropdown button markup.
*
* @param $variables
* An associative array containing:
* - label
* - Dropdown button label.
* - links
* - An array of menu links.
* - attributes (optional)
* - class: Array of additional classes like large, alert, round
* - data-dropdown: Custom dropdown id.
*
* @return string
*
* Formats links for Dropdown Button http://foundation.zurb.com/docs/components/dropdown-buttons.html
*/
function
zurb_foundation_links__dropdown_button
(
$variables
)
{
if
(
empty
(
$variables
[
'attributes'
][
'class'
]))
{
$variables
[
'attributes'
][
'class'
]
=
array
();
}
$variables
[
'attributes'
][
'class'
][]
=
'button'
;
$variables
[
'attributes'
][
'class'
][]
=
'dropdown'
;
if
(
!
isset
(
$variables
[
'attributes'
][
'data-dropdown'
]))
{
$variables
[
'attributes'
][
'data-dropdown'
]
=
drupal_html_id
(
'ddb'
);
}
$title
=
'<a href="#"'
.
drupal_attributes
(
$variables
[
'attributes'
])
.
'>'
.
$variables
[
'label'
]
.
'</a>'
;
$output
=
_zurb_foundation_links
(
$variables
[
'links'
]);
return
$title
.
'<ul id="'
.
$variables
[
'attributes'
][
'data-dropdown'
]
.
'" class="f-dropdown" data-dropdown-content>'
.
$output
.
'</ul>'
;
}
/**
* Implements theme_links() with foundations split button markup.
*
* @param $variables
* An associative array containing:
* - links
* - An array of menu links.
* - attributes (optional)
* - class: Array of additional classes like large, alert, round
* - data-dropdown: Custom dropdown id.
*
* @return string
*
* Formats links for Split Button http://foundation.zurb.com/docs/components/split-buttons.html
*/
function
zurb_foundation_links__split_button
(
$variables
)
{
$links
=
$variables
[
'links'
];
$link
=
array_shift
(
$links
);
if
(
empty
(
$variables
[
'attributes'
][
'class'
]))
{
$variables
[
'attributes'
][
'class'
]
=
array
();
}
$variables
[
'attributes'
][
'class'
][]
=
'button'
;
if
(
!
isset
(
$variables
[
'attributes'
][
'data-dropdown'
]))
{
$variables
[
'attributes'
][
'data-dropdown'
]
=
drupal_html_id
(
'ddb'
);
}
$id
=
$variables
[
'attributes'
][
'data-dropdown'
];
unset
(
$variables
[
'attributes'
][
'data-dropdown'
]);
$link
[
'#title'
]
.
=
'<span data-dropdown="'
.
$id
.
'"></span>'
;
$link
[
'#localized_options'
][
'attributes'
][
'class'
][]
=
'split'
;
$link
[
'#localized_options'
][
'html'
]
=
TRUE
;
$link
[
'#localized_options'
][
'attributes'
]
=
array_merge_recursive
(
$link
[
'#localized_options'
][
'attributes'
],
$variables
[
'attributes'
]);
$primary_link
=
l
(
$link
[
'#title'
],
$link
[
'#href'
],
$link
[
'#localized_options'
]);
$output
=
_zurb_foundation_links
(
$links
);
return
$primary_link
.
'<ul id="'
.
$id
.
'" class="f-dropdown" data-dropdown-content>'
.
$output
.
'</ul>'
;
}
\ No newline at end of file
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