Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid field layout ID #84

Closed
heymarkreeves opened this issue Jan 31, 2020 · 6 comments
Closed

Invalid field layout ID #84

heymarkreeves opened this issue Jan 31, 2020 · 6 comments
Assignees
Labels
Bug Report Something isn't working

Comments

@heymarkreeves
Copy link

I just ran into Issue #79. So I removed the fields from the field layouts I had created and deleted the field layout tabs...and now my entire control panel is inaccessible.

Screen Shot 2020-01-31 at 3 47 48 PM

Craft 3.4.1.

@heymarkreeves
Copy link
Author

Fortunately I had a database backup from the last time I worked on the project and didn't lose anything. For a paid plugin that's only supposed to enable an organization layer, this is a pretty big concern. I was completely shut out of the control panel, and reviewing the database, that ID exists.

@heymarkreeves
Copy link
Author

As soon as I hit Install on the plugin again—which was uninstalled following the database backup restore, I get the error again.

If I can't rely on the plugin, I'd like to fully uninstall it, as there are still database tables intact from when it was installed.

Here's the full trace:

yii\base\InvalidConfigException: Invalid field layout ID: 30 in /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/src/behaviors/FieldLayoutBehavior.php:124
Stack trace:
#0 [internal function]: craft\behaviors\FieldLayoutBehavior->getFieldLayout()
#1 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/base/Component.php(297): call_user_func_array(Array, Array)
#2 /Users/markreeves/Sites/idg/codiak/craft/vendor/angellco/spoon/src/services/BlockTypes.php(534): yii\base\Component->__call('getFieldLayout', Array)
#3 /Users/markreeves/Sites/idg/codiak/craft/vendor/angellco/spoon/src/services/BlockTypes.php(166): angellco\spoon\services\BlockTypes->_populateBlockTypeFromRecord(Object(angellco\spoon\records\BlockType))
#4 /Users/markreeves/Sites/idg/codiak/craft/vendor/angellco/spoon/src/services/Loader.php(288): angellco\spoon\services\BlockTypes->getByContext('global', 'context')
#5 /Users/markreeves/Sites/idg/codiak/craft/vendor/angellco/spoon/src/services/Loader.php(246): angellco\spoon\services\Loader->fieldManipulator('global', false)
#6 /Users/markreeves/Sites/idg/codiak/craft/vendor/angellco/spoon/src/Spoon.php(96): angellco\spoon\services\Loader->run()
#7 [internal function]: angellco\spoon\Spoon->angellco\spoon{closure}(Object(yii\base\Event))
#8 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(yii\base\Event))
#9 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\services\...', 'afterLoadPlugin...', Object(yii\base\Event))
#10 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/src/services/Plugins.php(272): yii\base\Component->trigger('afterLoadPlugin...')
#11 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1351): craft\services\Plugins->loadPlugins()
#12 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/src/web/Application.php(103): craft\web\Application->_postInit()
#13 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#14 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#15 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/src/web/Application.php(91): yii\base\Application->__construct(Array)
#16 [internal function]: craft\web\Application->__construct(Array)
#17 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#18 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\web\Appli...', Array, Array)
#19 /Users/markreeves/Sites/idg/codiak/craft/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\web\Appli...', Array, Array)
#20 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(245): yii\BaseYii::createObject(Array)
#21 /Users/markreeves/Sites/idg/codiak/craft/vendor/craftcms/cms/bootstrap/web.php(51): require('/Users/markreev...')
#22 /Users/markreeves/Sites/idg/codiak/craft/public/index.php(20): require('/Users/markreev...')
#23 {main}

@heymarkreeves
Copy link
Author

I also encountered #57 when I was removing the field layouts.

@heymarkreeves
Copy link
Author

After removing the plugin (see #85), craft_spoon_blocktypes has 5 records. 3 of those have fieldLayoutId values that are not null. They are:

  • 30
  • 31
  • 32

Table craft_fieldlayouts only goes up to id=29.

@joshangell
Copy link
Contributor

Hi @circa1977, sorry you’re experiencing this issue.

Whilst I’m working on a fix for #79 you could try dropping that table entirely if you don’t mind losing the field configurations. It was an oversight on my part to not drop it when running uninstall - I will fix that during this next sprint.

If you want to resolve the error temporarily, I think what you’re running into can be solved by removing the fields and tabs from the field layouts like you did initially, then hitting save on the grouping view again.

Alternatively I would do a full restore from before the upgrade and pin your Craft version to 3.3.x until I get it working on 3.4.x

@joshangell joshangell self-assigned this Jan 31, 2020
@heymarkreeves
Copy link
Author

heymarkreeves commented Jan 31, 2020

If you want to resolve the error temporarily, I think what you’re running into can be solved by removing the fields and tabs from the field layouts like you did initially, then hitting save on the grouping view again.

If I enable the plugin, I can't access anything in the control panel. The moment I removed those fields, a disconnect emerged. Rolling back the database showed the plugin present, but not installed. If I install it, every control panel returns that error.

I had to remove the plugin. I've been purposely staying very lean on plugins in Craft to avoid conflicts and upgrade issues. Lesson learned, I think. I don't think I can justify this one.

@joshangell joshangell pinned this issue Feb 5, 2020
@joshangell joshangell added the Bug Report Something isn't working label Feb 5, 2020
joshangell added a commit that referenced this issue Feb 7, 2020
- Spoon-specific project config data is now wiped on uninstall ([#85](#85))

- Fixed an issue with updating to 3.5.x from 3.3.x ([#89](#89))
- Fixed an issue with removing field layouts from current block type configurations ([#84](#84))

* tag '3.5.2':
@joshangell joshangell unpinned this issue Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants