I am doing customization of WooCommerce but I want to show 3 fields in one row I have tried a lot but no success. I have pasted the image of current fields
screenshot
I want to show send amount, receive amount and provider in one row
this is the code about the custom field
woocommerce_form_field('receive', array(
'type' => 'text',
'required' =>true,
'class' => array(
'woocommerce-input-wrapper form-row form-row-first validate-required'
) ,
'label' => __('Receive Amount') ,
'placeholder' => __('Receive Amount') ,
) ,
$checkout->get_value('receive'));
Related
I want to create a drop-down list from two related entities "Category" and "sub-category".
Under symfony I know how to create it from a single entity at a time but I have not managed to do so in a way that in the drop-down list each category displays the subcategories that belongs to it as indicated in the figure bellow.
You have to give arrays to your 'choices' field, each one representing a category.
$builder->add('stockStatus', ChoiceType::class, array(
'choices' => array(
'Main Statuses' => array(
'Yes' => 'stock_yes',
'No' => 'stock_no',
),
'Out of Stock Statuses' => array(
'Backordered' => 'stock_backordered',
'Discontinued' => 'stock_discontinued',
),
),
));
you can find more information here: https://symfony.com/doc/current/reference/forms/types/choice.html#grouping-options
I have an object - Book with Persons collection inside (each person has name property) and I need to create a form type persons it is a collection simply checkbox but I would like to have as a label on each checkbox persons name how to do it ?
I have BookType:
$builder->add('persons', 'collection', array(
'type' => 'checkbox',
'options' => array(
'required' => false,
),
));
How to add label with persons name ??
I'm not sure if I understood your question, but I'll try to help you anyway.
Did you already tried this?
$builder->add('persons','entity', array(
'class' => 'VendorBundle:Entity',
'property' => 'name',
'label' => 'YourLabel'
))
(Adapt the code for your configurations by changing 'VendorBundle:Entity' and 'YourLabel' )
This adds a field in your form which has the 'property name' of each 'VendorBundle:Person' and has a label 'YourLabel' right before the dropdown field.
I have a problem, I need to change the default options for a “List-item” option in Option tree . Right now the default are “Title/Image/Link/Descriptions” .. I want to remove them and add my own. I have written this code:
array(
'id' => 'academic_success_content',
'label' => 'Academic Success Content',
'desc' => 'Enter the academic success content. It will appear in the home page in list items format',
'std' => '',
'type' => 'list-item',
'section' => 'academic_perfomance',
'settings' => array(
array(
'id' => 'academic_success',
'label' => 'Academic Success',
'type' => 'textarea-simple',
)
)
),
But when I preview the themes options , the default list item "title" is still there and I only want to see the Academic Success textarea. What should I do?
I also suffered from the same situation.
And after that, I use the older version of "list-item" and "gallery".
This has worked well. Ex: v2.4.6
Is the theme options page being included?
You'll need to reference it in your functions.php, something to the effect of:
require_once locate_template('/path-to-your/theme-options.php' );
I'm trying to come up with a way for a user to populate a form with only the fields needed for a given piece of content.
So for example I have a content type called "Research Project" and I want to add a series of measurements to each one.
eg.
Proj 1:
Water Sampling
Measurements:
Gallons of water collected - 20 gal
Ambient temperature at time of collection - 75 deg F
PPM lead found in water - 2 ppm
The measurements criteria would be entered into the system ahead of time and they would select it from a dropdown. I imagine the UI would look like this for the form:
select measurement from dropdown > Field to enter value
+ link to add unlimited new measurement and value rows
The measurements are variable from project to project, there's a lot of them and there's always new ones being added making it impractical to add every potential measurement as it's own CCK field. There's also too many different types of project to make content types for each project practical. So essentially I'm looking for the ability to build the form and populate results on the fly. How should I go about doing this? I could input my measurements as taxonomy terms, but then how could I assign and store a value for each?
there is two functions
field_create_field() can create field a itself.
field_create_instance() - binds a field to the bundle.
Example from this post:
$field = array(
'field_name' => 'field_' . $vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($field);
$instance = array(
'field_name' => 'field_' . $vocabulary->machine_name,
'entity_type' => 'node',
'label' => 'Tags',
'bundle' => 'article',
'description' => $vocabulary->help,
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => -4,
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
'teaser' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
),
);
field_create_instance($instance);
I'm having some issues with form tabindexing. I have two submit buttons in my form, and the one I want to be indexed first isn't. This is currently what I have on my buttons:
$form['prev']['#attributes']['tabindex'] = '0'
$form['next']['#attributes']['tabindex'] = '1'
On this live version it shows up in the attributes they show up on both buttons.
I'm using Drupal 7 and creating my own custom form module.
$form['company'] = array(
'#title' => t('Company'),
'#type' => 'textfield',
'#required' => TRUE,
'#attributes' => array('tabindex' => '6'),
);
this is how you set your tab index programatically.