← Back to Content Editor Passage Extension Support
Francisco Guerrero
Hello, I'm getting the following error message when using the plugin:
Call to undefined method KurtJensen \ Passage \ Plugin :: getUser ()
\ plugins \ wizkidweb \ contenteditorpassageextension \ components \ ContentEditor.php line 63.
return $ ret;
}
}
public function checkEditor ()
{
if (! is_null (PassagePlugin :: getUser ())) { //****** <- ERROR LINE ******//
if ($ this-> init) {
return! empty ($ this-> key) && in_array ($ this-> key, PassagePlugin :: passage_keys ());
}
return true;
}
Please help, thanks!!!!
Last updated
bpettis
Here is the solution that worked for me. Replaced the component ContentEditor.php with this and it should work. @Francisco
<?php namespace Wizkidweb\ContentEditorPassageExtension\Components;
use Samuell\ContentEditor\Components\ContentEditor as ContentEditorBase;
use Samuell\ContentEditor\Models\Settings;
use KurtJensen\Passage\Plugin as PassagePlugin;
use Auth;
class ContentEditor extends ContentEditorBase
{
public $key;
public $init = false;
public function componentDetails()
{
return [
'name' => 'Content Editor w/Passage Keys',
'description' => 'Edit your front-end content in page, secured by passage keys.'
];
}
public function defineProperties()
{
$properties = parent::defineProperties();
$properties['key'] = [
'title' => 'Passage Key',
'description' => 'The user passage key to match against',
'default' => 'manage_content'
];
return $properties;
}
public function onRun()
{
if ($this->checkEditor()) {
$this->init = true;
$this->buttons = Settings::get('enabled_buttons');
$this->palettes = Settings::get('style_palettes');
// put content tools js + css
$this->addCss('../../samuell/contenteditor/assets/content-tools.min.css');
$this->addCss('../../samuell/contenteditor/assets/contenteditor.css');
$this->addJs('../../samuell/contenteditor/assets/content-tools.min.js');
$this->addJs('../../samuell/contenteditor/assets/contenteditor.js');
}
}
public function onRender()
{
$this->key = $this->property('key');
$ret = parent::onRender();
if (!$this->checkEditor()) {
return $ret;
}
}
public function checkEditor()
{
if (!is_null(Auth::getUser())) {
if ($this->init) {
return !empty($this->key) && in_array($this->key, Auth::getUser()->getGroups()->pluck('name')->toArray());
}
return true;
}
return parent::checkEditor();
}
}
Last updated
1-2 of 2