PHP code example of boboldehampsink / migrationshelper
1. Go to this page and download the library: Download boboldehampsink/migrationshelper 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/ */
boboldehampsink / migrationshelper example snippets
/**
* Get a field group by name
*
* @param string $name
* @return FieldGroupModel|null
*/
$group = MigrationsHelper::getFieldGroupByName($name);
/**
* Append a field to a source's fieldlayout programmatically.
*
* @param BaseModel $source The element's source (e.g. a EntryTypeModel or CategoryGroupModel)
* @param FieldModel $field The field's model
* @param int $index The index of the field on the tab (optional - defaults to 0)
* @param string $tabName The fieldlayout's tab (optional)
*
* @return BaseModel
*/
MigrationsHelper::addToFieldLayout(BaseModel $source, FieldModel $field, $index = 0, $tabName = '');
// Save source (e.g. Entry Type)
craft()->sections->saveEntryType($source);
/**
* Change the settings of a given field.
*
* @param string $context The field's context (e.g. global, matrixBlockType:1, etc.)
* @param string $handle The field's handle
* @param array $attributes An array of key/value settings
*/
MigrationsHelper::changeFieldSettings($context, $handle, array $attributes);