Comments (26)
Hm that is strange. I am working with it all the time. Never had this issue.
Can you provide me your PHP version, Craft version en Froala editor version?
[edit]
Can you try to add this line in the top of the file?
use froala\craftfroalawysiwyg\Plugin;
This should not be necessary as far I know, but I'd like to know if it helps.
from craft-3-froala-wysiwyg.
Yep!
PHP: 7.3.3, though I tested 7.2 and 7.1 as well.
Craft: 3.1.23 (currently the latest)
froala/wysiwyg-editor: v2.9.3
froala/craft-froala-wysiwyg: 2.9.3
After composer require froala/craft-froala-wysiwyg
, I went in to plugins and clicked install. Also tried via the plugin store with the same effect.
This happens after I create a new field, choose froala as the field type, and click save
Adding that to the top of the Field.php file did not have an effect
from craft-3-froala-wysiwyg.
Disabled all plugins and it installed successfully - looks like this was the culprit:
https://straightupcraft.com/craft-plugins/two-factor-authentication
Sorry for the false alarm!
from craft-3-froala-wysiwyg.
Ah that's cool. Therefor I saw that it is a Craft 2 plugin
from craft-3-froala-wysiwyg.
Sorry to reopen this - the plugin also fails with the same install error if Snitch or SEOmatic is installed. It seems something in this plugin isn't playing nicely with several other plugins
from craft-3-froala-wysiwyg.
Can you provide more details? like the exact error message from the log files. This way I can take a closer look. But I also can't imagine, since I am using the editor with several other plugins too.
from craft-3-froala-wysiwyg.
I think it's related to this commit: marionnewlevant/craft-snitch@a18fec2
Downgrading the snitch plugin and removing 2factor plugin entirely allowed froala to install.
Full stack trace here:
Error: Call to a member function getSettings() on null in /Users/testuser/froala-test/web/vendor/froala/craft-froala-wysiwyg/src/Field.php:60
Stack trace:
#0 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/base/BaseObject.php(109): froala\craftfroalawysiwyg\Field->init()
#1 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/helpers/Component.php(80): yii\base\BaseObject->__construct(Array)
#2 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/services/Fields.php(548): craft\helpers\Component::createComponent(Array, 'craft\\base\\Fiel...')
#3 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/services/Fields.php(573): craft\services\Fields->createField(Array)
#4 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1536): craft\services\Fields->getAllFields()
#5 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1073): craft\elements\db\ElementQuery->customFields()
#6 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#7 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/db/Query.php(146): yii\db\QueryBuilder->build(Object(craft\elements\db\UserQuery))
#8 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/db/Query.php(274): yii\db\Query->createCommand(Object(craft\db\Connection))
#9 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/db/Query.php(177): yii\db\Query->one(NULL)
#10 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1215): craft\db\Query->one(NULL)
#11 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/elements/User.php(366): craft\elements\db\ElementQuery->one()
#12 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/web/User.php(690): craft\elements\User::findIdentity('2')
#13 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/web/User.php(488): yii\web\User->renewAuthStatus()
#14 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/web/User.php(192): craft\web\User->renewAuthStatus()
#15 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/web/User.php(360): yii\web\User->getIdentity()
#16 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/web/User.php(193): yii\web\User->getIsGuest()
#17 /Users/testuser/froala-test/web/vendor/marionnewlevant/snitch/src/Plugin.php(43): craft\web\User->getIsGuest()
#18 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/base/BaseObject.php(109): marionnewlevant\snitch\Plugin->init()
#19 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#20 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/base/Plugin.php(127): yii\base\Module->__construct('snitch', Object(craft\web\Application), Array)
#21 [internal function]: craft\base\Plugin->__construct('snitch', Object(craft\web\Application), Array)
#22 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)
#23 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('marionnewlevant...', Array, Array)
#24 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('marionnewlevant...', Array, Array)
#25 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/services/Plugins.php(897): yii\BaseYii::createObject(Array, Array)
#26 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/services/Plugins.php(230): craft\services\Plugins->createPlugin('snitch', Array)
#27 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/base/ApplicationTrait.php(1225): craft\services\Plugins->loadPlugins()
#28 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/web/Application.php(112): craft\web\Application->_postInit()
#29 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#30 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#31 /Users/testuser/froala-test/web/vendor/craftcms/cms/src/web/Application.php(100): yii\base\Application->__construct(Array)
#32 [internal function]: craft\web\Application->__construct(Array)
#33 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)
#34 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#35 /Users/testuser/froala-test/web/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#36 /Users/testuser/froala-test/web/vendor/craftcms/cms/bootstrap/bootstrap.php(255): yii\BaseYii::createObject(Array)
#37 /Users/testuser/froala-test/web/vendor/craftcms/cms/bootstrap/web.php(42): require('/Users/testuser/pos...')
#38 /Users/testuser/froala-test/web/web/index.php(20): require('/Users/testuser/pos...')
#39 /Users/testuser/.composer/vendor/laravel/valet/server.php(158): require('/Users/testuser/pos...')
#40 {main}
from craft-3-froala-wysiwyg.
Probably because they do something with entries and fields and one of the fields is a Froala editor field. I don't know exactly. Since Snitch is not my plugin.
Can you try my suggestion from earlier?
#11 (comment)
from craft-3-froala-wysiwyg.
Hey I did try that, adding that to the top of the Field.php file did not have an effect
from craft-3-froala-wysiwyg.
Shouldn't be necessary too. I really don't know. I am going to try the Snitch plugin, but that's a little out of my scope. I will come back later on this.
from craft-3-froala-wysiwyg.
ok! i'll keep trying the same, i'm starting down this road now craftcms/cms#1641
from craft-3-froala-wysiwyg.
I'm not entirely sure what's behind this, but I added this check around line 60 of Field.php and it started loading:
public function init()
{
parent::init();
$testing = Plugin::getInstance();
if ($testing) {
$this->pluginSettings = Plugin::getInstance()->getSettings();
}
//$this->pluginSettings = Plugin::getInstance()->getSettings();
}
Since i'm still seeing it pull my config.json file and custom css, it looks like the settings are still being pulled in as well
from craft-3-froala-wysiwyg.
Yeah probably Snitch (or another plugin) is doing fancy stuff with plugins or something..
What you did is testing if the plugin could be loaded. It would load normally when needed, since Craft does it the right way itself.
from craft-3-froala-wysiwyg.
@bertoost This issue is caused due to Field.php being mapped as the entry point, not Plugin.php so the plugin is never loaded into Yii::$app->loadedModules
.
I believe this is resolved by adding "class": "froala\\craftfroalawysiwyg\\Plugin"
to your composer.json
extra data, see link below. While it SHOULD auto detect Plugin.php
I believe that it could be a case-sensitive filesystem issue or something weird.
https://docs.craftcms.com/v3/extend/plugin-guide.html#composer-json
from craft-3-froala-wysiwyg.
Okay. But that's something up to Craft CMS I guess? I did how they describe and took over some examples from their own editor integrations.
@brandonkelly maybe you can say something about it? :-)
from craft-3-froala-wysiwyg.
@bertoost I had a bit more of a play with this and go a fork thats working now via composer. the Field.php
had a method called init()
which seems to have triggered it. I'll submit a PR from my fork.
from craft-3-froala-wysiwyg.
Thanks @reganlawton ! Still think that class
definition in the composer.json
file shouldn't be necessary. Therefore I can imagine that using the init()
in the field class, is causing some troubles. Did you tried that change without the class
definition?
I also was thinking of moving the Field.php
and FieldData.php
to a sub-folder/namespace. But also feels kinda unnecessary since Craft's Redactor also has the same file structure
from craft-3-froala-wysiwyg.
Yes it will work without the ”class” I might have been left over due to testing. It doesn’t do any harm so I can remove or keep.
You shouldn’t need to refactor file paths with the current PR changes. Saying that I normally manage my code in sub folders.
from craft-3-froala-wysiwyg.
Yeah me too. But this was copied from other plugins ;-)
Thanks for clearing out that the class
definition is not necesarry. I know it can be there without any issues, but I'd like to define as less as possible.
from craft-3-froala-wysiwyg.
Copy and paste are greatest tool but also our greatest source of issues 😂. It’s currently bedtime here AEST but I’ll get that PR tweaked in the morning for you.
from craft-3-froala-wysiwyg.
I copied from Craft's core team. Expect them to know what they're doing ;-)
Have a good night! Thanks again.
from craft-3-froala-wysiwyg.
Oh god that’s gold 😂😂😂 and no issues 👍
from craft-3-froala-wysiwyg.
What Snitch is doing is calling Craft::$app->getUser()->getIsGuest()
which is getting the custom fields, which calls the froala Field->init()
before the froala module is loaded.
from craft-3-froala-wysiwyg.
Hmm 🤔 if the patch I delivered doesn’t resolve the snitch issue there “is” the option to initialise the plugin in the Field.php as a fallback for this edge case but would need to know that the PR doesn’t work before trying to figure a clean way to do that.
from craft-3-froala-wysiwyg.
Thanks @marionnewlevant ! That was something I was looking for, but didn't have the time yet to investigate.. I knew it was something from Snitch what was causing the issue.
This should also happen then when using Redactor.
from craft-3-froala-wysiwyg.
This might be continued in my fix. When the field.php is loaded then the init() is most likely called which pulls the settings from the unloaded plugin. I do have Redactor currently installed.
from craft-3-froala-wysiwyg.
Related Issues (17)
- Froala editor settings config file per field
- Media library not working in craft 3.1 HOT 1
- Retrieving HTML within a Craft API attempts to render HTML, which breaks some things. HOT 5
- toolbarSticky not working HOT 11
- YouTube embed stripped out with HTML Purifier is on.
- This plugin is not displaying all the Froala Plugins
- Uploaded images not saving HOT 3
- Saving entry with control+s doesn’t work
- Browsing assets loads a generic group of images instead of customer assets library HOT 1
- Table previews are not displaying correctly
- Custom Craft plugins (Asset and Entry/URL selection) not working with Froala v3 and v4 HOT 1
- Craft 4 Support
- Removing global plugins does not remove features from editor HOT 4
- Insert an image in a froala field will always insert the image in the last field typed froala.
- Plugin does not generate a config folder or example .json files for Custom Editor Config HOT 2
- Image and File sources are not properly configured for this field. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craft-3-froala-wysiwyg.