Child Content Type (Drupal) - drupal

I need to create two content types (Call List and Call Announcements), in Call Announcements there are 5 fields, in Call List there are 12 fields but 5 of them are mutual with Call Announcements, I do not want to create 2 different content types (Call List, Call Announcements) because when the user create a node, he should be able to choose where the node is shown (in Call List, in Call Announcements, Both).
(Call List and Call Announcements should be in the same database table)
How can I do these?
http://i.stack.imgur.com/LAgXM.png

You can create a single content type containing all the fields.
After that add a field with checkboxes with the options like, "show on call list" and "show on call announcements), This extra field can be used to decide how the create/edit/view behaves.
When Creating/Updating content.
Now you may go ahead and install conditional fields, if you want to conditionally show some field based on the values of checkboxes selected.
When viewing content
Use views to display the list. Here you can decide what is shown in the list by filtering the list by the checkbox values. As a bonus extra views would help you decide what fields need to be shown to the user.

Related

How do I make subform row items appear only once in an HTML table in zoho creator snippet pages?

Table Screenshot I need a single row of Engineer with count 2 in head count
I have attached a screenshot. Category fields are fetched from a subform rows and rows can contain similar categories. I want to show category only once in this table with its count in head count. For example Engineer - 2 and not as it is currently being shown.
Use the distinct option from Zoho Creator data access task to get the unique list of Category. Then use this list to fetch the count of each item.
This also depends on how the subform was included in the main form and whether you are looking to fetch the count per each record of the main form or for all records in the main form.
If the subform was directly created insider the main form, you will have to follow the above method. If the subform was created separately and then embedded into the main form, you can directly apply the Count and Distinct operations instead of iterating through all values.
Store the Category in the list. in loop check, if the category already exists or not then add into list.

Make Drupal 7 Group by always show grouping field

I have a Drupal 7 view similar to the one described here: Drupal 7 Views - list group by field
I wish to have all the groupby fields always appear even if there are not members of them and ideally I wish to put a default value in such a list.
eg:
Foo:
-Jay
-George
Bar:
-Barry
Boo:
Sorry no entries at this time!
Suggestions?
If none of what you are fetching with the view is associated with the group 'Boo' then the view doesnt know it exists, so would never be able to show it but say there is no results for it.
What i would recommend is creating a taxonomy vocabulary with the terms: Foo, Bar, Boo.
In whatever content type your names belong to, create a term reference field, and link them to the terms.
In the view, fetch the taxonomy terms, create a relationship to the content type that references the taxonomy, and pull those through based on that. There is a setting in views for multiple results to combine into one field (so you would want to do that). Then you could add the 'Sorry no entries at this time!' as a field's no results text.
So to recap: VIEW => TAXONOMY TERMS => NAME CONTENT

Drupal: Creating a view that retrieves related nodes based on terms

I'm trying to wrap my head around getting nodes that share the same taxonomy terms, but I have some questions.
Essentially, I want to display a view at the bottom of my event node that shows related events. I have tags for each event and will be using those to create the match.
In views, when I create a taxonomy argument and add multiple "tags" it searches for nodes with all the specified arguments. What I want is not to search just for nodes that contain all of the arguments, but nodes that contain either or. So far I haven't figured any solutions.
Edit:
Would it be easier to create a simple block module that queries the database for nodes that contain the terms?
I am using a Taxonomy Term ID as argument and then I selected the checkbox that allows Multiple Terms per argument. Notice the help text that says, "If selected, users can enter multiple arguments in the form of 1+2+3 (for OR) or 1,2,3 (for AND)." By using the + sign you will OR the arguments together, but if you use the , then they will be AND together thus forcing nodes to have all terms. For this specific view I am providing the default argument via php and I am using the plus sign to wrap the term ID arguments together. This will give me all the nodes that are tagged with any of the terms supplied as arguments.
edit: I might want to also add that I have the checkbox selected for "Let Multiple arguments work together." That may or may not be needed for your use case, but I needed it for mine.

Drupal Views and exposed filters - how to reset optional drop-down list filter, or allow "all" selection

I have a view with a filter by country. Country is an optional CCK text field with drop-down list selection from a predefined list.
When I expose the field as an optional view search filter, I can select a country on the filter form just fine, but how can I handle no selection? I want the user to be able to "un-select" any previously selected value so that the query runs for all countries (or, to be more precise, does not constrain the results by country). I cannot add "all" as a value to the CCK field for obvious reasons. Selecting all countries in the drop-down on the search filter is not very user-friendly and causes the page to time out (there are over 200 countries in the list, and I can only imagine the resulting SQL query). Whats the best way to handle this?
I found this View Filters Reset hack which could be helpful. The desire to memorize the last selection adds another complication - when configured in the View properties, and once the (persistent) cookie is set, there is no way to get rid of the selection (short of manually deleting the cookie).
The answer was to check "Force Single" on the filter properties. This made <any> show up as a selection in the country filter drop-down. It kind of makes sense, because <any> in a multiple-selection list could be seen as ambiguous. Still, I can think of valid reasons why a multiple selection filter might be optional. Drupal surprises me every day.

Views 1: Filter by custom table/field (or using Argument Hand. Code)

I have a page which should list nodes. The views is called from a locality page (a taxonomy term page). What I need is almost the same as using the Taxonomy: tid in arguments and passing the tid.
I can't use the term_node table, as (for other reasons) we have a custom table term_node_hierarchy (with nid and tid only). The table term_node_hierarchy is like term_node but also saves the tid of the parents (from an "external" code)
I've been looking for options but still no joy.
Currently I'm building an array of the nid's that should be displayed on the current page, and passing them like print views_build_view('embed', $view, $matching_nids); but the Argument Node: ID states This argument is a single Node ID. As said, only the first node is displayed when printing the views. It would be great if it could filter on more than one nid.
I'm open to any kind of suggestions on how to do this.
Thanks
You could create your own module for this. You could populate the $page_content variable with the results of your own custom query where you allow the user to sort against multiple nids. You could do this a number of different ways. You could display a list of the existing nids with corresponding checkboxes, so that, when the user clicks submit, all the nids that match the selected checkboxes get used in the query. Then you just display the result of that query. That's the easiest way I can think of to offer that degree of flexibility.

Resources