Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifying preprocess and theme override functions
- Loading branch information
1 parent
0f76986
commit 3dc8b7b
Showing
6 changed files
with
112 additions
and
3 deletions.
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
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,23 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Overrides container classes/markup | ||
*/ | ||
|
||
/** | ||
* Overriding theme_container() | ||
*/ | ||
function BootstrapBlocks_container($variables) { | ||
$element = $variables['element']; | ||
|
||
if (isset($element['#array_parents'])) { | ||
if (!isset($element['#attributes']['id'])) { | ||
$element['#attributes']['id'] = $element['#id']; | ||
} | ||
|
||
$element['#attributes']['class'][] = 'form-wrapper'; | ||
$element['#attributes']['class'][] = 'form-group'; | ||
} | ||
|
||
return '<div' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</div>'; | ||
} |
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,67 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Modifies item list markup | ||
*/ | ||
|
||
/** | ||
* Overrides theme_item_list(). | ||
*/ | ||
function BootstrapBlocks_item_list($variables) { | ||
$items = $variables['items']; | ||
$title = $variables['title']; | ||
$type = $variables['type']; | ||
$attributes = $variables['attributes']; | ||
$output = ''; | ||
|
||
if (isset($title)) { | ||
$output .= '<h3>' . $title . '</h3>'; | ||
} | ||
|
||
if (!empty($items)) { | ||
$output .= "<$type" . drupal_attributes($attributes) . '>'; | ||
$num_items = count($items); | ||
$i = 0; | ||
foreach ($items as $item) { | ||
$attributes = array(); | ||
$children = array(); | ||
$data = ''; | ||
$i++; | ||
if (is_array($item)) { | ||
foreach ($item as $key => $value) { | ||
if ($key == 'data') { | ||
$data = $value; | ||
} | ||
elseif ($key == 'children') { | ||
$children = $value; | ||
} | ||
else { | ||
$attributes[$key] = $value; | ||
} | ||
} | ||
} | ||
else { | ||
$data = $item; | ||
} | ||
if (count($children) > 0) { | ||
// Render nested list. | ||
$data .= theme('item_list', array( | ||
'items' => $children, | ||
'title' => NULL, | ||
'type' => $type, | ||
'attributes' => $attributes, | ||
)); | ||
} | ||
if ($i == 1) { | ||
$attributes['class'][] = 'first'; | ||
} | ||
if ($i == $num_items) { | ||
$attributes['class'][] = 'last'; | ||
} | ||
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n"; | ||
} | ||
$output .= "</$type>"; | ||
} | ||
|
||
return $output; | ||
} |
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