Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Corrected spelling.
Source Link
Free Radical
  • 15.1k
  • 9
  • 48
  • 83

How do I programatically add a field to a node?

i'mI'm trying to create custom drupalDrupal 7 module , in. In the form setting offor the module iI have checkboxes wichwhere the admin can select multiple content typetypes:

enter image description here

After installing the module iI need to automatically create towtwo fields (Price of type decimal  (4,2), and currency of type text) only in just to the selected 'content types' the admin has selected from the list above.

andAnd this is how iI set the content type to the checkboxes list in the 'mymodule_payment_admin_settings_form'mymodule_payment_admin_settings_form hook in 'mymodule.module' mymodule.module:

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );

add field to node

i'm trying to create custom drupal 7 module , in the form setting of the module i have checkboxes wich the admin can select multiple content type

enter image description here

After installing the module i need to automatically create tow fields (Price of type decimal(4,2) currency of type text) in just to the selected 'content types' from the list above

and this is how i set the content type to the checkboxes list in the 'mymodule_payment_admin_settings_form' hook in 'mymodule.module' :

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );

How do I programatically add a field to a node?

I'm trying to create custom Drupal 7 module. In the form setting for the module I have checkboxes where the admin can select multiple content types:

enter image description here

After installing the module I need to automatically create two fields (Price of type decimal  (4,2), and currency of type text) only in the 'content types' the admin has selected from the list above.

And this is how I set the content type to the checkboxes list in the mymodule_payment_admin_settings_form hook in mymodule.module:

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );
added 381 characters in body
Source Link

i'm trying to create custom drupal 7 module , in the form setting of the module i have checkboxes wich the admin can select multiple content type

enter image description here

After installing the module i need to automatically create tow fields (Price of type decimal(4,2) currency of type text) in just to the selected 'content types' from the list above

and this is how i set the content type to the checkboxes list in the 'mymodule_payment_admin_settings_form' hook in 'mymodule.module' :

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );

i'm trying to create custom drupal 7 module , in the form setting of the module i have checkboxes wich the admin can select multiple content type

enter image description here

After installing the module i need to automatically create tow fields (Price of type decimal(4,2) currency of type text) in just to the selected 'content types' from the list above

i'm trying to create custom drupal 7 module , in the form setting of the module i have checkboxes wich the admin can select multiple content type

enter image description here

After installing the module i need to automatically create tow fields (Price of type decimal(4,2) currency of type text) in just to the selected 'content types' from the list above

and this is how i set the content type to the checkboxes list in the 'mymodule_payment_admin_settings_form' hook in 'mymodule.module' :

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );
Source Link
Loading