Modify form using rules

Events happening in the community are now at Drupal community events on www.drupal.org.
mcartmel's picture

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...

Comments

Do you found solution?

mac2000's picture

Do you found solution, I have exactly same problems, changin $form in custom php code takes no effect.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: