ninja_forms_edit_field_label_pos

The Ninja Forms ninja forms edit field label pos function.

Description

ninja_forms_edit_field_label_pos( $field_id, $field_data ); 

Parameters (2)

0. $field_id
The field id.
1. $field_data
The field data.

Usage

  1. if ( !function_exists( 'ninja_forms_edit_field_label_pos' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/edit-field/label.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The field data. 
  8. $field_data = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ninja_forms_edit_field_label_pos($field_id, $field_data); 
  12.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/admin/edit-field/label.php  
  1. function ninja_forms_edit_field_label_pos( $field_id, $field_data ) { 
  2. global $ninja_forms_fields; 
  3. $field_row = ninja_forms_get_field_by_id($field_id); 
  4. $field_type = $field_row['type']; 
  5. $reg_field = $ninja_forms_fields[$field_type]; 
  6. $edit_label_pos = $reg_field['edit_label_pos']; 
  7. $label_pos_options = $reg_field['label_pos_options']; 
  8.  
  9. if( !$label_pos_options OR $label_pos_options == '' ) { 
  10. $options = array( 
  11. array('name' => __( 'Left of Element', 'ninja-forms' ), 'value' => 'left'),  
  12. array('name' => __( 'Above Element', 'ninja-forms' ), 'value' => 'above'),  
  13. array('name' => __( 'Below Element', 'ninja-forms' ), 'value' => 'below'),  
  14. array('name' => __( 'Right of Element', 'ninja-forms' ), 'value' => 'right'),  
  15. array('name' => __( 'Inside Element', 'ninja-forms' ), 'value' => 'inside'),  
  16. ); 
  17. }else{ 
  18. $options = $label_pos_options; 
  19.  
  20. if($edit_label_pos) { 
  21. if(isset($field_data['label_pos'])) { 
  22. $label_pos = $field_data['label_pos']; 
  23. }else{ 
  24. $label_pos = 'above'; 
  25.  
  26. ninja_forms_edit_field_el_output($field_id, 'select', __( 'Label Position', 'ninja-forms' ), 'label_pos', $label_pos, 'wide', $options, 'widefat'); 
  27.