I am trying to set up a json api in Drupal 7 using services and rest_server.
So far i can get a list of Nodes at http://localhost/api/node.json
and view a specific node at http://example.com/api/node/{id}.json
Is it possible to customise the fields that are displayed in the index view ??(http://example.com/api/node.json)
Specifically i want to add one or two custom fields to my custom content type which need to appear in the index json when querying the api
This is possible, by adding the module "Services Views"
You can choose on the view all fields you need.
I just did by myself right now.
I hope that will help you or somebody :)
Jerome
Related
Good day.
There is a problem: display news block on specific pages of any type of material.
I see the solution as follows: Create a field in the type of material "News" which will be displayed all the nodes (Title) with the possibility of using the mark checkboxes.
Who could help with advice: is it the right direction, and if yes - how to realize this field?
Thanks in advance for any help.
Download and enable Entity API and Entity reference modules.
Then go to your content type "Manage fields" page (admin/structure/types/manage/[CONTENT_TYPE]/fields) and add a new field of type Node reference. The rest of the configuration is left for your liking.
I am trying to display different content types on Drupal as views slideshow, including twitter, images, and blogs. Currently they are all saved in a field (unlimited value fields). I am going to extract these values to nodes as views only accepts node type values. I am wondering what is the best way to do it? I am new to drupal and can think of following ideas:
1. Use one node type, and create a display mode for this node type with customized codes
2. A separate node type for different content types, and each node type with some display mode
3. A minipanel for each node type,is it possible to display it in view slideshow?
4. some code to get data directly from fields, and export to views?
5. Or I use Colorbox and completely forget about View Slideshow?
Please help. Thanks.
You must set all the content types you want to pull in the query in the "edit" form of the view. It is not possible using only the one-step setup, you must choose "continue & edit" and then add different content types to your slideshow view.
Iam very new to Drupal 7 so bear with me. I have created a jQueryUI drag and drop interface with JQueryUI tabs. My problem is i cant find the correct hook to add this custom interface to the admin interface. Like so (mockup) http://onlinemedia.rmcad.edu/sandBox/screenshot/screen-shot.jpg
All the examples I find are using CCK fields. CCK fields are great but they dont have this kind of custom functionality I want or does it?
Any help would very much be appreciated.
J
cck is drupal 6, not 7. to add to the node creation form you could use hook_form_alter or hook_form_ID_alter.
Check the form api documentation to get an idea of how to add stuff to the form object in either of those hooks.
From your mockup I understand you intend to add this drag&drop interface to a content-type.
If that's the case, I'd recommend you to add the appropriate fields first. Those would help storing the data in Drupal way, once the node is saved.
Once you are satisfied with the fields collecting the data you need, create a module and use hook_form_FORM_ID_alter hook to integrate your "interface", the presentation layer by altering those fields.
If you don't want to add CCK/Field components to store your data how about you create your own database table and store your custom data in there?
This approach is a long one but I have used it to great effect on a very big and complex project.
You will need a custom module with an install script which contains the details of your custom database table.
Forgive me but I don't remember the hook for altering a node-edit-form but that is where you input the code which implement your drag-'n'-drop elements.
Then, you could save the settings altogether when the node-edit form is submitted but I think it's probably better to implement some AJAX to save the settings to your custom database table. So, when a component is dropped into it's final resting place, you use AJAX to save that information to the database.
When a user comes back to edit that page, you simply load your custom settings and apply them to the drag-'n'-drop features and their previous configuration(s) would be visible to them.
I do hope that makes sense and it helps you.
I would like to know what is the best way to create a custom page for my client where he can update is content by himself, the simpliest way possible for him, without even entering drupal management.
I would like to create a page with different dropdown list where he can't update a table on a page, only by selecting an item in those and add other dropdown list as well.
For example: he logs in a custom page
Theres a list with different kind of fruits, he choose banana and it automaticaly update a page table and update it with banana.
After that he could also create a new drop down list of vegetables for example, and add different kind in it so he can use it to update the site later. All that done with ajax as well.
I'm very new to drupal and have a couple of php notions, but i don't know where to start, would it be in CCK, Views or Form Api or the three at the same time?
Or is there a module out there doing that kind of thing?
English is not my primary language, so sorry if it isn't very clear.
Thank you very much.
I think what you are looking for is CCK module. You can create a CCK content type and have a field within it called fruits. From the admin interface you can decide what are the values that should be in the dropdown.
You can give the client permission to create a node of the content type. If you think he should be able to edit only the drop down values, make sure you give him the permission to only that field.
You can create a listing page using http://drupal.org/project/views or you can also consider using
http://drupal.org/project/editview
You should take a look at views bulk operations, and try using the "modify node fields" feature which will allow you to perform bulk operations on node fields displayed in a view and then look into roles & permissions which will help you restrict viewing the "View" by role.
I need help on how to create a 'custom form' using the same fields provided by cck.
Drupal gives you the ability to add fields to 'nodes' and how to theme their output. But I would like to be able to post a data from my own form (that pops-up) and sends data to the drupal database using the same drupal cck.
How do I access the specific form inputs to add data to my content types ? because the default form is kind of 'ugly' and loads on different page(without ajax).
Help would be much appreciated
There are several routes you could go down.
The easier option is to use the Webforms module. While this gives you similar fields to cck, they are not exactly the same, and if you have a module that implements a specific cck field type, it won't be available to webforms.
The second choice is to write your own module using the forms api. This can mean a lot of learning, add it takes time to get up to speed, but ultimately you have total control over how your form will look and behave. The forms api doesn't give you exactly the same fields, but all the tools are there to create them. Sometimes you need to hack open a module to find out haw a specific field is implemented.
A third option would be to use cck itself. You could create a content type and add the field types you want on your form. You would them give users permission to create but not view or edit the content type. The form submissions would them be nodes on your website. This would make me slightly nervous, so make sure all your permissions are correct!
The second part of your question: you can use a theme file to override the appearance of most forms and make them pretty.
James