Hello All,
To update a client’s site to use PHP 8, I’ve updated C5 version 8.5.5 to 9.1.3. Doing so has presented a lot of challenges. I have managed to get the site working but issues persist with the custom packages that are in place.
Previously, these packages required assets and loaded them in the following way:
$this->requireAsset('core/file-manager');
$this->requireAsset('core/sitemap');
$this->requireAsset('redactor');
$html = Loader::helper('html');
$this->addHeaderItem($html->css('https://cdn.jsdelivr.net/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.css'));
$this->addHeaderItem($html->javascript('https://cdn.jsdelivr.net/bootstrap.tagsinput/0.8.0/bootstrap-tagsinput.min.js'));
$this->addHeaderItem($html->css($this->getBlockAssetPath().'/form.css'));
$this->addHeaderItem($html->javascript($this->getBlockAssetPath().'/form.js'));
In order to get it working in 9.1.3, I have had to heavily refactor this to point precisely at the files it needs, using the addHeaderItem in some instances; there has to be an easier way. Even with the refactor, I am not able to edit images specifically in edit mode. When I try to select an image, I don’t get the same options.
Before:
After:
Additionally, there are a number of errors that appear in the console:
Uncaught TypeError: this._$notificationsBox.find(...).collapse is not a function
redactor is not a function
Can anyone point me in the right direction as to what needs to be done? Or are there any good examples for custom packages that require assets? I can’t find any information thus far that’s helpful.