<?php
Yii::app()->hooks->addAction('after_list_created_list_default_fields', function ($params) {
$fieldType = ListFieldType::model()->findByAttributes([
'identifier' => 'text',
]);
$model = new ListField();
$model->list_id = $params->list->list_id;
$model->type_id = $fieldType->type_id;
$model->label = 'First name';
$model->tag = 'FIRST_NAME';
$model->required = ListField::TEXT_NO;
$model->sort_order = $params->lastSortOrder++;
$model->save();
});
$model->sort_order = $params->lastSortOrder++; // after this line!
$model->country = '';
<?php
Yii::app()->hooks->addAction('after_list_created_list_default_fields', function ($params) {
$countryType = ListFieldType::model()->findByAttributes([
'identifier' => 'country',
]);
$model = new ListField();
$model->list_id = $params->list->list_id;
$model->type_id = $countryType->type_id;
$model->label = 'Country';
$model->tag = 'COUNTRY';
$model->required = ListField::TEXT_NO;
$model->sort_order = $params->lastSortOrder++;
$model->default_value = '[SUBSCRIBER_GEO_COUNTRY]';
$model->save();
});