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

Hide the comments panes when comments are disabled. #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions ding_content/ding_content.module
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ding_content_form_alter(&$form, $form_state, $form_id) {
'#type' => 'fieldset',
'#title' => t('Revision information'),
'#collapsible' => TRUE,
// Collapsed by default when "Create new revision" is unchecked
// Collapsed by default when "Create new revision" is unchecked.
'#collapsed' => !$node->revision,
'#weight' => 20,
);
Expand Down Expand Up @@ -93,5 +93,18 @@ function ding_content_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
}
}

require_once('ding_content.features.inc');
/**
* Implements hook_panels_pane_content_alter().
*/
function ding_content_panels_pane_content_alter(&$content, $pane, $args, $context) {
// Hide the node comments pane when comments are disabled for a node.
if ($pane->type == 'comment_login' || $pane->type == 'node_comments') {
$node = menu_get_object();
if ($node && $node->comment == COMMENT_NODE_DISABLED) {
// Overwrite content with an empty object.
$content = new stdClass();
}
}
}

require_once 'ding_content.features.inc';