nloyola Posted December 15, 2021 Share Posted December 15, 2021 When I create a FieldtypeCombo using RockMigrations I get the following error when I try to add the combo to a page: PagesEditor: Error saving field "Options" — SQLSTATE[42S22]: Column not found: 1054 Unknown column 'i1' in 'field list' Here is the code I use to create the field: $this->rm()->createField('wrapper_options', 'FieldtypeCombo', [ 'tags' => self::TAG, 'label' => 'Options', 'flags' => '0', 'i1_label' => 'Tag Type', 'i1_name' => 'tag_type', 'i1_type' => 'Select', 'qty' => '4', 'hideWrap' => '0', 'collapsed' => '0', 'useColNames' => '0', 'modSchema' => '0', 'useDataCol' => '0', 'i1_options' => '+div section', 'i1_ok' => '1', 'i1_collapsed' => '0', 'i1_columnWidth' => '25', 'order' => '1,2,3,4', 'i2_label' => 'Background', 'i2_name' => 'background', 'i2_type' => 'Select', 'i2_options' => '+None Color Gradient Image', 'i2_ok' => '1', 'i2_collapsed' => '0', 'i2_columnWidth' => '25', 'i3_label' => 'Width', 'i3_name' => 'width', 'i3_type' => 'Select', 'i3_options' => '+Full Width Max Width', 'i3_ok' => '1', 'i3_collapsed' => '0', 'i3_columnWidth' => '25', 'i4_label' => 'Spacing', 'i4_name' => 'spacing', 'i4_type' => 'Select', 'i4_options' => '+Padding Margin', 'i4_ok' => '1', 'i4_collapsed' => '0', 'i4_columnWidth' => '25', ]); If I edit the field using the PW admin dashboard, and then save it, the problem goes away. I.e. the field is created properly in the database. Am I missing something when creating the field using RockMigrations? Thank you 1 Link to comment Share on other sites More sharing options...
nloyola Posted December 17, 2021 Author Share Posted December 17, 2021 I fixed the problem by creating the field with the ComboField class. E.g. $f = new ComboField(); $f->type = $this->modules->get("FieldtypeCombo"); $f->name = 'heading_options'; $f->label = 'Options'; $f->addable = 1; $f->tags = self::TAG; $f->i1_label = 'Class'; $f->i1_name = 'class'; $f->i1_type = 'Select'; $f->i1_ok = '1'; $f->i1_collapsed = '0'; $f->i1_columnWidth = '50'; $f->i1_options = '+heading-copy=Copy heading-secondary--a=Secondary A heading-secondary--b=Secondary B'; $f->save(); $this->rm()->getField('heading_options')->save(); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now