juek / CustomSections

Developer plugin for rapid prototyping of custom section types in Typesetter CMS
GNU General Public License v2.0
3 stars 7 forks source link

Link Field "unsafe.replace is not a function" #29

Closed thomasfrobieter closed 7 years ago

thomasfrobieter commented 7 years ago

I have no idea what's wrong. If i add a link field like this:

section.php: 'link' => array( 'url' => 'https://www.example.com', 'target' => '_self', ),

editor.php:

        'link' => array(
          'label' => '<i class="fa fa-globe"></i> Button Link',
          'control_type' => 'link_field',
          'attributes' => array(
            'placeholder' => '#top, /MyPage or http://www.google.com',
          ),
          'on' => array(
            'focus' => 'function(){ $(this).select(); }',
          ),
        ),

I got this error (JS Console):

Object { thrownError: TypeError, message: "unsafe.replace is not a function", fileName: "http://typesetter.vorlagen.webks.de…", lineNumber: 1653, columnNumber: 11, Line-1652: "    console.log(unsafe);", Line-1653: "   return unsafe", Line-1654: "    .replace(/&/g, "&amp;")", responseStatus: 200, statusText: "OK", 4 weitere… }
Object { url: "https://www.beispiel.de", target: "_self" }  jquery.js:1652:5 // result of my console.log(unsafe) inside the universal_editor/editor.js

Any idea what's wrong? Sure, .replace won't work here because it's an object, not a string, but .. i think the link field is defined correctly .. so.. i don't know.

It's the current CustomSections version here from Github.

a2exfr commented 7 years ago

Link conttol type field currently unsupported in bunch control may be this is the reason

thomasfrobieter commented 7 years ago

Aah, okay ;) Yes, it's inside a bunch control. So i will use a simple text field till it's supported. Thx for the fast feedback!