In this section we want to show how you can easily add comments to any content-type.
For that purpose we already included some styles for a basic comment-setup; all you need to do is some site-building, no biggie.
The final result will look something like this:
1. create a new image style
- go to: Configuration » Media » Image styles » Add style
- name the style something like "Comments Avatar"
- add effect Scale and crop
- set width and height to 60px
2. enable comments
- go to: Structure » Content types » your-content-type
- set Comment settings » Default comment setting for new content to Open
note: already existing content will not have the comments enabled.
3. add comments to the content-type-display
- go to: Structure » Content types » your-content-type » manage display
- select the respective display-mode (e.g. Full content)
- drag the comments into place (for example the Footer region)
note: make sure you got Display Suite UI enabled ($ drush en -y ds_ui
)
4. set the display for the comments
- go to: Structure » Content types » your-content-type » comment display » layout
- select the ERPAL Comments layout
- save
- drag the fields to match the given setup
- set the user picture format to Comments Avatar (or however you named it in step 1)
note: don't forget the lable-config
5. hide subject and author fields
finally: adding the following code to a custom modules my_module.module should do the trick:
<?php
/**
* Implements hook_form_comment_form_alter().
*
* Removing unneeded fields from comment form.
*/
function my_module_form_comment_form_alter(&$form, &$form_state) {
// Remove subject.
unset($form['subject']);
// Remove author field for users, when not editing.
if ($form['is_anonymous']['#value'] == false && arg(2) != 'edit') {
$form['author']['#access'] = false;
}
return $form;
}