Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49197

Modify form using rules

$
0
0

Hi Rules people,

I'm trying to modify a node edit form to add one field based on a the user role. The idea is to add a checkbox which says "I am authorized to make changes".

  • I've created a new rule which runs when "node form is being built".
  • I've added an action "Execute custom PHP code".
  • The PHP code is as follows:
    $form['iagree'] = array(
          '#type' => 'checkbox',
          '#title' => t('I am authorized to make changes'),
          '#description' => t('By checking this box, you agree that you are responsible for the content of this page and you are authorized to make all changes.'),
    );

Unfortunately, this does not seem to modify the form and the field is not added. Is this the expected behavior?

Yes, I know I can do this in a custom module, but I would like to try and utilize the extra flexibility that the Rules module provides for applying conditions...


Viewing all articles
Browse latest Browse all 49197

Trending Articles