Skip to content
Code-Schnipsel Gruppen Projekte
getBrick.php 799 B
Newer Older
Henning Leutz's avatar
Henning Leutz committed
<?php

/**
 * This file contains package_quiqqer_bricks_ajax_getBrick
 */

/**
 * Returns the Brick data
 *
 * @param {String|Integer} $brickId - Brick-ID
Henning Leutz's avatar
Henning Leutz committed
 * @return array
 */
Henning Leutz's avatar
Henning Leutz committed
QUI::$Ajax->registerFunction(
    'package_quiqqer_bricks_ajax_getBrick',
Henning Leutz's avatar
Henning Leutz committed
    function ($brickId) {
        $BrickManager = QUI\Bricks\Manager::init();
        $Brick        = $BrickManager->getBrickById($brickId);
Henning Leutz's avatar
Henning Leutz committed

Henning Leutz's avatar
Henning Leutz committed
        return array(
            'attributes' => $Brick->getAttributes(),
            'settings' => $Brick->getSettings(),
            'customfields' => $Brick->getCustomFields(),
            'availableSettings' => $BrickManager->getAvailableBrickSettingsByBrickType(
                $Brick->getAttribute('type')
            )
        );
    },
Henning Leutz's avatar
Henning Leutz committed
    array('brickId'),
    'Permission::checkAdminUser'
);