From 7f16d61e2f76975443268f581b7a7a31189392dd Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Tue, 10 Mar 2015 11:47:21 +0100 Subject: [PATCH] Remove notices from user profile edit form Remove undefined index notices from user profile edit form, caused by groups_comment_text_format_alter() inproper variable check. Change-Id: I168a2dd119b403be601b2ec186a06cced81aacaa --- modules/groups/groups_comment/groups_comment.module | 12 +++++++----- modules/groups/groups_groups/groups_groups.module | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/groups/groups_comment/groups_comment.module b/modules/groups/groups_comment/groups_comment.module index b66d07e..c23f741 100644 --- a/modules/groups/groups_comment/groups_comment.module +++ b/modules/groups/groups_comment/groups_comment.module @@ -36,10 +36,12 @@ function groups_comment_form_comment_form_alter(&$form, &$form_state) { * Set default text format to markdown for the group/body field. */ function groups_comment_text_format_alter(&$element) { - if (($element['#bundle'] == 'comment_node_post') && ($element['#field_name'] == 'comment_body')) { - // set default value to markdown - $element['format']['format']['#default_value'] = 'markdown'; - // hide text format filter - $element['format']['#access'] = FALSE; + if ((isset($element['#bundle'])) && (isset($element['#field_name']))) { + if (($element['#bundle'] == 'comment_node_post') && ($element['#field_name'] == 'comment_body')) { + // set default value to markdown + $element['format']['format']['#default_value'] = 'markdown'; + // hide text format filter + $element['format']['#access'] = FALSE; + } } } \ No newline at end of file diff --git a/modules/groups/groups_groups/groups_groups.module b/modules/groups/groups_groups/groups_groups.module index 24e58ab..8e4954a 100644 --- a/modules/groups/groups_groups/groups_groups.module +++ b/modules/groups/groups_groups/groups_groups.module @@ -143,11 +143,13 @@ function groups_groups_theme() { */ function groups_groups_text_format_alter(&$element) { $bundles = array('group', 'post'); - if ((in_array($element['#bundle'], $bundles)) && ($element['#field_name'] == 'body')) { - // set default value to markdown - $element['format']['format']['#default_value'] = 'markdown'; - // hide text format filter - $element['format']['#access'] = FALSE; + if ((isset($element['#bundle'])) && (isset($element['#field_name']))) { + if ((in_array($element['#bundle'], $bundles)) && ($element['#field_name'] == 'body')) { + // set default value to markdown + $element['format']['format']['#default_value'] = 'markdown'; + // hide text format filter + $element['format']['#access'] = FALSE; + } } }