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

TreeMultiSelectField causes JS issues in CMS #7806

Closed
2 tasks done
phptek opened this issue Jan 28, 2018 · 2 comments
Closed
2 tasks done

TreeMultiSelectField causes JS issues in CMS #7806

phptek opened this issue Jan 28, 2018 · 2 comments

Comments

@phptek
Copy link

phptek commented Jan 28, 2018

Affected Version

PHP 7.0.27 + silverstripe/installer 4.0.2 (vanilla install) + Chromium / Ubuntu 16.04

Description

bundle.js?m=1516829605:1 Uncaught TypeError: Cannot read property 'fields' of undefined

First saw this JS error via Chrome developer tools in a CWP project. I traced it back to CWP\CWP\BasePage where TreeMultiSelectField is included. Commenting it out made the error go away.

For completeness, I tested it in isolation via a vanilla 4.0.2 (installer) setup = same problem. The error basically means that some of the "advanced" TinyMCE buttons are inoperable e.g. "Insert Image From Files", "Insert Media Via URL" etc. Clicking them renders similar JS errors such as:

Uncaught TypeError: Cannot read property 'sections' of undefined

Steps to Reproduce

1). Setup the following basic `Page
2). Login to the CMS
3). Open the "Home" page.
4). Observe the above error(s) in developer console

  1 <?php
  2 
  3 use SilverStripe\CMS\Model\SiteTree;
  4 use SilverStripe\Forms\TreeMultiselectField;
  5 
  6 class Page extends SiteTree
  7 {
  8     private static $db = [];
  9 
 10         public function getCMSFields()
 11         {
 12                 $fields = parent::getCMSFields();
 13                 $fields->addFieldToTab(
 14                     'Root.Tags',
 15                     TreeMultiselectField::create(
 16                         'Terms',
 17                         _t(__CLASS__ . '.Terms', 'Terms'),
 18                         SiteTree::class
 19                     )->setDescription(_t(__CLASS__ . '.TermsDescription', 'Click to search for additional terms'))
 20                 );
 21                 return $fields;
 22 
 23         }
 24     
 25     private static $has_one = [];
 26 }

Pull requests

@robbieaverill
Copy link
Contributor

Yep, I had the same error on Friday with TreeDropdownField

@tractorcow
Copy link
Contributor

Seems to affect entwine shived react fields only, and seems to be related to entwine state not booting at the right time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants