Skip to content

Commit

Permalink
NEPT-3002: PHPCS usage of the hook hook_form_alter() is forbidden.
Browse files Browse the repository at this point in the history
  • Loading branch information
julien- committed Aug 3, 2022
1 parent c5df29e commit 4726206
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ function _tmgmt_dgt_connector_cart_restore_cart_bundles(CartBundle &$cart_bundle
}
}

// @codingStandardsIgnoreStart
/**
* Implements hook_form_alter().
*
Expand All @@ -419,6 +420,7 @@ function tmgmt_dgt_connector_cart_form_alter(&$form, &$form_state, $form_id) {

}
}
// @codingStandardsIgnoreEnd

/**
* Helper function to add the custom cart button to the sources pages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function version_management_menu() {
return $items;
}

// @codingStandardsIgnoreStart
/**
* Implements hook_form_alter().
*
Expand Down Expand Up @@ -82,6 +83,7 @@ function version_management_form_alter(&$form, &$form_state, $form_id) {
}
}
}
// @codingStandardsIgnoreEnd

/**
* Helper function to build the version_management checkbox.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function cce_basic_config_preprocess_field(&$variables) {
}
}

// @codingStandardsIgnoreStart
/**
* Implements hook_form_alter().
*/
Expand All @@ -147,6 +148,7 @@ function cce_basic_config_form_alter(&$form, &$form_state, $form_id) {

return $form;
}
// @codingStandardsIgnoreEnd

/**
* Implements hook_form_FORM_ID_alter().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,35 +137,46 @@ function multisite_forum_community_menu_community_access_callback() {
}

/**
* Implements hook_form_alter().
* Implements hook_form_FORM_ID_alter().
*/
function multisite_forum_community_form_alter(&$form, $form_state, $form_id) {

if ($form_id == 'forum_overview') {
$form['#empty_text'] = t('No containers or forums available.');
}

function multisite_forum_community_form_forum_overview_alter(&$form, $form_state, $form_id) {
if (($context = og_context())) {
if ($form_id == 'forum_overview') {
$form['#empty_text'] = t("No forums available.");
foreach (element_children($form) as $key) {
if (strstr($key, 'tid:') !== FALSE) {
$tid = $form[$key]['#term']['tid'];
$form[$key]['edit']['#href'] = "group/node/{$context['gid']}/admin/forum/edit/forum/{$tid}";
}
$form['#empty_text'] = t("No forums available.");
foreach (element_children($form) as $key) {
if (strstr($key, 'tid:') !== FALSE) {
$tid = $form[$key]['#term']['tid'];
$form[$key]['edit']['#href'] = "group/node/{$context['gid']}/admin/forum/edit/forum/{$tid}";
}
}
}
else {
$form['#empty_text'] = t('No containers or forums available.');
}
}

if ($form_id == 'forum_form_forum' || $form_id == 'forum_form_container') {
$form['#submit'][] = 'multisite_forum_community_forum_form_main_submit';
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function multisite_forum_community_form_forum_form_forum_alter(&$form, $form_state, $form_id) {
if ((og_context())) {
$form['#submit'][] = 'multisite_forum_community_forum_form_main_submit';
}
}

/**
* Implements hook_form_FORM_ID_alter().
*/
function multisite_forum_community_form_forum_form_container_alter(&$form, $form_state, $form_id) {
if ((og_context())) {
$form['#submit'][] = 'multisite_forum_community_forum_form_main_submit';
}
}

/**
* Implements submit handler.
*
* @see: multisite_forum_community_form_alter()
* @see: multisite_forum_community_form_forum_form_forum_alter()
* @see: multisite_forum_community_form_forum_form_container_alter()
*/
function multisite_forum_community_forum_form_main_submit($form, &$form_state) {
if (($context = og_context())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* introduced by Maxlength contributed module in field settings page.
*/

// @codingStandardsIgnoreStart
/**
* Implements hook_form_alter().
*/
Expand All @@ -28,3 +29,4 @@ function multisite_maxlength_form_alter(&$form, &$form_state, $form_id) {
}
}
}
// @codingStandardsIgnoreEnd

0 comments on commit 4726206

Please sign in to comment.