-<{if $box->showHeader}section{else}div{/if} class="box{if $box->getImage()} boxWithImage{/if}{if $box->cssClassName} {$box->cssClassName}{/if}" data-box-identifier="{@$box->identifier}">
+<{if $box->showHeader}section{else}div{/if} class="box{if $box->getImage()} boxWithImage{/if}{if $box->showEditButton()} boxWithEditButton{/if}{if $box->cssClassName} {$box->cssClassName}{/if}" data-box-identifier="{@$box->identifier}">
+ {if $box->showEditButton()}
+ <a href="{link controller='Box' id=$box->boxID isACP=true}{/link}" class="boxEditButton"><span class="icon icon16 fa-pencil-square-o"></span></a>
+ {/if}
{if $box->getImage()}
<div class="boxImage">
{if $box->hasLink()}
*/
public $virtualShowOrder = -1;
+ /**
+ * list of positions that support the edit button
+ * @var string[]
+ */
+ public $editButtonPositions = ['headerBoxes', 'sidebarLeft', 'contentTop', 'sidebarRight', 'contentBottom', 'footerBoxes', 'footer'];
+
/**
* @inheritDoc
*/
$this->virtualShowOrder = $virtualShowOrder;
}
+ /**
+ * Returns true if an edit button should be displayed for this box.
+ *
+ * @return boolean
+ * @since 3.2
+ */
+ public function showEditButton() {
+ if (WCF::getSession()->getPermission('admin.content.cms.canManageBox') && in_array($this->position, $this->editButtonPositions)) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Returns the box with the given identifier.
*