Skip to content

Instantly share code, notes, and snippets.

@adamjakab
Created March 6, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamjakab/d5a88b1ae6d006ddaf27790673410aad to your computer and use it in GitHub Desktop.
Save adamjakab/d5a88b1ae6d006ddaf27790673410aad to your computer and use it in GitHub Desktop.
form #submit with static class method reference
<?php
/**
* Created by Adam Jakab.
* Date: 06/03/17
* Time: 12.43
*/
namespace Agora\Alter\Form\Id;
use Mekit\Drupal7\HookInterface;
class UserProfileForm implements HookInterface
{
/**
* @param array $form
* @param array $form_state
*/
public static function execute(&$form, &$form_state)
{
$form['#submit'][] = ['\Agora\Alter\Form\Id\UserProfileForm', 'customSubmit'];
}
public static function customSubmit($form, &$form_state)
{
drupal_goto(url('<front>'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment