Skip to content

Commit

Permalink
feat: add support for showing RockPageBuilder block type
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 26, 2023
1 parent ff0068b commit d577ea7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Alfred.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
*/
function Alfred() {}

Alfred.prototype.addIcons = function (el, icons) {
Alfred.prototype.addIcons = function (el, icons, type) {
let html = "<div class=icons>";
if (type) {
html += "<span class='rpb-type'><span>" + type + "</span></span>";
}
icons.forEach(function (icon) {
// console.log(icon);
html +=
Expand Down Expand Up @@ -85,7 +88,7 @@
let $elements = $(el).find(".alfredelements");
try {
let config = JSON.parse($(el).attr("alfred"));
this.addIcons($elements, config.icons);
this.addIcons($elements, config.icons, config.type);
if (config.widgetStyle) $(el).addClass("rpb-widget");
if (config.addTop) $elements.append(this.plus("top", config.addTop));
if (config.addBottom)
Expand Down
1 change: 1 addition & 0 deletions RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ public function alfred($page = null, $options = [])
'addLeft' => $opt->addLeft,
'addRight' => $opt->addRight,
'widgetStyle' => $opt->widgetStyle,
'type' => $opt->type,
]);

// save markup to cache and generate alfred tag
Expand Down

0 comments on commit d577ea7

Please sign in to comment.