Jump to content

Recommended Posts

Posted

Hi,

the default comment form ($page->comments->renderForm()) only includes "name", "email" and "text" but I need an URL field so that the person who is commenting can add its URL.

Is there a way to realize this?

Greets,

Nico

Posted

You'd probably want to make a copy of the FieldtypeComments and modify/rename it towards your needs. You'd need to change the DB schema that it uses so that you'd have a URL field, and then update the CommentForm class to accept it and save it. Basically, I'd just duplicate everything for the 'email' field to make a URL field. When it comes to sanitizing it, you'd just use the $sanitizer->url() rather than $sanitizer->email(). URLs are kind of open-ended in terms of what characters they allow, so make sure you run it through htmlentities() before outputting anywhere at runtime.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...