I'm trying to make form to post advert in newspaper and want to let user select style of future post and show how it will be printed. So i create taxonomy vocab. "style" with name, sample image and max. characters to this type.
Next i'm creating field taxonomy term relation in advert content type.
Now i need to show in adding form not just radios or select with titles but title, sample image and other fields from taxonomy.
I think i need to use hook_form_alter so i use mymodule_form_ad_node_form_alter(&$form, &$form_state, $form_id) but what i can't understand is how in drupal way i can get rest of taxonomy fields? In $form array is only tids and titles.
Is it possible not to query DB again but setup existing query to retrieve all fields i need?
Also how i can insert that additional information into form? Is it other way than #suffix #prefix on radios?
If this is a Drupal 7 then you can use an Entity Reference field along with the Entity Reference view widget instead of a term reference field. That will allow you to specify a view to use to populate the field options, and you can create an entity reference view that display the additional taxonomy term fields you want to display.
Related
I have implemented normal search functionality in simple pages using php and MySQL where I get result rows by mysqli_fetch_array. There I could have any numbers of variable with AND or OR relationship and it will retrieve results from the db.
Now I am trying to do this in WordPress.
I have seen solutions where one uses WP_query to search by term names. How do I achieve this AND and OR variables in my search query.
For example, my query is like select all post title where term name like 'search keyword' AND term slug like 'hi'.
I have created a view terms_and_posts table from merging terms and posts tables using taxonomy relationship, with columns custom term name, custom term slug, post title, post content, post status, and post type.
Do I need a merged table or it can be achieved by modifying WP_Query?
I do not want to resort to using plugins as I am very new to WordPress, and I prefer not to use plugins as long as I can help it.
I have a form to create a Provider Entity.
The provider have a name and a list of products he can provide.
In the form, I want to show all the basics products (stored in DB), and so the user check the different products he can provide.
This is quite easy to do with the EntityType with multiple and expanded to true.
BUT i want also the user to add a description field of the selected product.
Example :
List of products : Vegetables, Meat, Honey...
The user check "Vegetables", and then a textfield appear so the user can write "carrots and salads".
I could create a Collection Type with a form entry where there is a select and a text field, but it will looks like :
select your product -- Description field ------------------------- Add new product
And I would prefer a multiple and extended list of all available products (with checkbox) and every time a checkbox is checked, a description fields appear at the bottom of the list.
The thing is I've done it quite easy with basic javascript and php, but I'm riting again my website using Symfony...
Thank for your help !
I created a WordPress website that contains 3 custom post types.
teacher
class
video
My requirement is
(1) when adding video I need to select the teacher's name and save it. (i.e. teacher as category in video post type)
(2) when adding classes I need to select both teacher's name and video and save it.
How do I do that?
I am new to symfony 2. I have a table categories and a table products. Each product is linked to a category with a categoryid field in product table. I want that the category select box should populate at product form inside a select box (combo box) and the list of categories should come from categories table. If i save the product form and re-open the form to edit then category should be auto-selected that i had saved during creating the new product.
I have really spent a lot of time to search such example but could find. Can someone please give me such example or link to such tutorial?
Thanks in advance.
You have to use Form Events. Here is an example:
http://showmethecode.es/php/symfony/symfony2-4-dependent-forms/
Entity Choices
you should use an Entity form type (it may be useful to override __toString of the category entity) or if you don't want to expose too much stuff you should use data transformers
I have the following scenario:
I have a content type called 'Product' in which there are the default input fields and a number of custom input fields that have been created using CCK.
When a new product is created, all of the data entered is posted as a node (as normal).
Part of the problem is that I don't want the values from the custom input fields to be within the node content. Therefore, my thinking was to hide the display of these fields. I could then create a block of the custom input fields using views.
Is it possible within views to set up some filtering that will only display the values of the custom input fields on the node from which it was originally created? For example if the product I created had a node id of 1, is it possible to filter the view to display the values of the custom input fields that were created from node id of 1 and then display these values as a block on node id 1?
This might sound a confusing approach but I am keen to separate some of the data entered into the Product content type from the main node content, mainly for styling reasons.
Thanks, Mark.
Ah worked it out. It's always an easy solution isn't it?
In the Arguments section of the view, add Node: Node ID. Select the action of 'Provide default argument' and then select 'Node ID from URL' from the 'Default argument type:'.
This will then just display the values of the custom input fields that was created on a particular node.