1. Go to this page and download the library: Download esign/craft-cms-crud library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
esign / craft-cms-crud example snippets
use esign\craftcmscrud\controllers\CraftEntryController;
class YourController extends CraftEntryController
{
CraftEntryController::updateOrCreateEntry($entry);
}
use esign\craftcmscrud\support\CraftEntry;
new CraftEntry(
$handle,
$identifier,
$fields,
$matrixBlocks,
$nestedEntries
)
use esign\craftcmscrud\support\CraftMatrixBlock;
new CraftMatrixBlock(
$handle,
$handleBlock,
$fields
)
use esign\craftcmscrud\support\CraftAsset;
new CraftAsset(
$handle,
$imageUrl,
$filename,
$path,
)
use esign\craftcmscrud\controllers\CraftEntryController;
use esign\craftcmscrud\support\CraftEntry;
use esign\craftcmscrud\support\CraftMatrixBlock;
CraftEntryController::updateOrCreateEntry(
new CraftEntry(
self::HANDLE_CLUB,
self::IDENTIFIER_CLUB,
ClubModel::fieldsFromClub($club),
[
new CraftMatrixBlock(
self::HANDLE_OPENING_HOURS,
self::HANDLE_OPENING_HOURS_BLOCK,
$club->{self::HANDLE_OPENING_HOURS}
),
...
],
[
new CraftEntry(
self::HANDLE_CLUB_TAGS,
self::IDENTIFIER_CLUB_TAGS,
ClubModel::collectionFieldsFromClubTags($club->{self::HANDLE_CLUB_TAGS})
),
...
],
[
new CraftAsset(
self::HANDLE_IMAGE,
$contract->mlContractImageUrl,
StringHelper::beforeFirst(StringHelper::afterLast($contract->mlContractImageUrl, '/'), '?'),
self::HANDLE_IMAGE_PATH
)
],
),
);
use esign\craftcmscrud\controllers\CraftEntryController;
use esign\craftcmscrud\support\CraftEntry;
use esign\craftcmscrud\support\CraftMatrixBlock;
public const MATRIX_BLOCKS_CONTRACT_TERM = [
'mlTermPriceAdjustmentRules' => 'mlPriceBlock',
'mlTermFlatFees' => 'mlFeeBlock',
'mlTermOptionalModules' => 'mlOptionalBlock',
'mlTermRateBonusPeriods' => 'mlBonusBlock',
];
CraftEntryController::updateOrCreateEntry(
new CraftEntry(
self::HANDLE_CONTRACT,
self::IDENTIFIER_CONTRACT,
Entry::fieldsFromContract($contract),
null,
[
new CraftEntry(
self::HANDLE_CONTRACT_TERM,
self::IDENTIFIER_CONTRACT_TERM,
Entry::collectionFieldsFromContractTerms(
$contract->{self::HANDLE_CONTRACT_TERM}
),
CraftEntryController::parseNestedMatrixBlocks(
$contract->{self::HANDLE_CONTRACT_TERM},
self::MATRIX_BLOCKS_CONTRACT_TERM
),
),
],
),
);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.