public static function createBrickFromPostValues($postValues)
    {
        if (isset($postValues['title'])) {
            $brickObject = new \stdClass();
            $brickObject->title = $postValues['title'];
            $brickObject->slug = StringUtil::slugify($postValues['title']);
            $brickObject->fields = array();
            if (isset($postValues['fieldTitles'], $postValues['fieldTypes'], $postValues['fieldRequired'], $postValues['fieldMultiple'])) {
                foreach ($postValues['fieldTitles'] as $key => $value) {
                    $fieldObject = self::createFieldObject($postValues, $value, $key);

                    $brickObject->fields[] = $fieldObject;
                }
            }

            return $brickObject;
        } else {
            throw new \Exception('Trying to create document type with invalid data.');
        }
    }
public static function createBrickFromPostValues($postValues)
    {
        if (isset($postValues['title'])) {
            $brickObject = new \stdClass();
            $brickObject->title = $postValues['title'];
            $brickObject->slug = StringUtil::slugify($postValues['title']);
            $brickObject->fields = array();
            if (isset($postValues['fieldTitles'], $postValues['fieldTypes'], $postValues['fieldRequired'], $postValues['fieldMultiple'])) {
                foreach ($postValues['fieldTitles'] as $key => $value) {
                    $fieldObject = self::createFieldObject($postValues, $value, $key);

                    $brickObject->fields[] = $fieldObject;
                }
            }

            return $brickObject;
        } else {
            throw new \Exception('Trying to create document type with invalid data.');
        }
    }
public static function createBrickFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] ) ) { $ brickObject = new \ stdClass ( ) ; $ brickObject -> title = $ postValues [ 'title' ] ; $ brickObject -> slug = StringUtil :: slugify ( $ postValues [ 'title' ] ) ; $ brickObject -> fields = array ( ) ; if ( isset ( $ postValues [ 'fieldTitles' ] , $ postValues [ 'fieldTypes' ] , $ postValues [ 'fieldRequired' ] , $ postValues [ 'fieldMultiple' ] ) ) { foreach ( $ postValues [ 'fieldTitles' ] as $ key => $ value ) { $ fieldObject = self :: createFieldObject ( $ postValues , $ value , $ key ) ; $ brickObject -> fields [ ] = $ fieldObject ; } } return $ brickObject ; } else { throw new \ Exception ( 'Trying to create document type with invalid data.' ) ; } }
Create a brick from post values

@param $postValues

@return \stdClass
@throws \Exception
Create a brick from post values