Home > fields > How to create content type programmatically with fields and vertical tabs

How to create content type programmatically with fields and vertical tabs

February 3Hits:4
Advertisement

I'm creating a module using Drupal7.26 and want to create content type with different type of fields like radio/checkboxes/drupdown and textfields.

I'm following the last comment by Jason Gray in THIS thread and is working pretty well except it is not creating Fieldset, Vertical Tab Group and Vertical Tab when the module is installed.

What I did is:
I have created a custom module to create new Content Type by following SITEPOINT tutorial. And take the fields array by exporting of the node which I created manually using CCK with all fields that I want.

Now all the fields are showing in my newly created node by installing module, except (Fieldset, Vertical Tab Group and Vertical Tab) which I created by enabling Field group module.

NOTE: When I export the content type using feature as (test) it gives me 3 files as bellow:
1 - test.features.field_base.inc (I take fields array from here)
2 - test.features.field_instance.inc (I take instances array from here)
3 - test.field_group.inc (it give me the bellow hook) which I'm not sure where/how to use it.I place it in both MYMODULE.install and MYMODULE.module files both didn't work.

    function test_field_group_info() {      } 

Any ideas would be appreciated.

Answers

Wooho :) here is the answer I was missing hook_ctools_plugin_api() in my module

Related Articles

  • How to create content type programmatically with fields and vertical tabsFebruary 3

    I'm creating a module using Drupal7.26 and want to create content type with different type of fields like radio/checkboxes/drupdown and textfields. I'm following the last comment by Jason Gray in THIS thread and is working pretty well except it is no

  • Create Content type with metadata fieldDecember 18

    I made the following Powershell script to create a content type with a text field and a numeric field: $url = "http://my-sharepoint-site" $web = get-spweb $url $ctypeName = "Content type X" $ctypeParent = $web.availablecontenttypes[&qu

  • Programmatically creating a content type with file field in a custom moduleJune 14

    I'm writing a custom module, which I've done before, but this is the first time I've tried to create a content type with fields. I implemented hook_node_info and the Content Type is showing up in the list of Content types in the dropdown from admin_m

  • How do you programmatically modify a programmatically created content type?December 1

    I'm creating a Drupal 7 site that has many content types which are defined programmatically. It is quite likely that, after launch, I will be required to slightly modify some of the content types. During development, whenever I need to make a change,

  • When creating a content type programmatically, is there a way to disable promoting to the front page by default?December 9

    In Drupal 7, I'm creating a large number (15+) of content types programmatically. There is one in particular that should never be promoted to the front page. It would be really nice if, by default, the box to do this was unchecked. I'm aware that thi

  • Creating a content type with dynamic fieldsJuly 16

    I'm trying to create a content type where the fields are updated dynamically. For example, I could have two term reference fields: Manufacturer and Product Name. When the user chooses the manufacturer in the form, the Product Name field would only di

  • Add new field to content type programmatically June 28

    Say I have this field, "map_description". I know I would this function to define the field: $field = array( 'field_name' => 'map_description', 'cardinality' => 1, 'type' => 'text', ); field_create_field($field); And I have this code whi

  • How do I create new content type with editable fields?October 19

    I want to create another content type similar to the basic page. I've designed a simple html layout with a block of copy on the left hand side and an image with a caption floated next to it on the right hand side. I want to be able to add this as a t

  • Programmatically created content type don't have a delete link

    Programmatically created content type don't have a delete linkFebruary 12

    I'm developing a module that creates new content types through form that I created (not in hook_install): function create_new_content_type($type, $name){ $t = get_t(); $new_node = array( 'type' => $type, 'name' => $name, 'base' => 'node_content',

  • Assign existing field to new content type programmaticallyFebruary 17

    I'm developing a module that create a several new content types: function create_new_content_type($type, $name){ $t = get_t(); $new_node = array( 'type' => $type, 'name' => $name, 'base' => 'node_content', 'custom' => TRUE, //'description' =&g

  • Programmatically created content type module title not workingApril 8

    I created a module with a .info, .module and .install file that can be installed by customers. This module file to create content types from node consists basically atm of: /** * Implements hook_node_info() */ function mycontent_node_info() { return

  • How to re-create content types using the feature module which removes deleted fields?

    How to re-create content types using the feature module which removes deleted fields?December 6

    I've been looking into the Feature module to move changes from Dev to Staging without redoing everything. On my Dev site I made changes in the content types (added new fields, deleted some field). Then I exported all content types as a feature and im

  • Drupal 7: Modifying the view page and edit form of a content type programmaticallyFebruary 1

    a Drupal newbie here trying to create his first module for Drupal 7. In my site I've created a new content type (machine name: abstract) from the site's admin's front-end. A user can add a new instance of this content type by using a form I've define

  • Adding a new content type programmatically in .install file or .module file?September 13

    There are 2 different ways to create a new content type programmatically. First one, which I also use, is to create it in your custom module's .install file in hook_install() using node_type_save() and attaching the fields also in hook_install() with

  • Content Type no showing fields

    Content Type no showing fieldsOctober 22

    I have been trying to created a content type programmatically in Drupal 7. I notice that I should use the hook_node_info to generate the content type with the title and to add the body I should use the node_add_body_field. I have been follow the exam

  • Display custom block to specific content type programmaticallyAugust 3

    I created one custom module, it will create one custom block when it is installed. I want to display it on "product" content type only. Can I do the same with programmatically. It'll save my time. Here is my code. <?php function my_module_blo

  • How to create content type programaticallySeptember 11

    how to create content type programatically and attach field api fields to it? hook_node_info() will not work for me since i want to create my node type and its instance in a single method (for testing purposes), so kindly suggest a solution other tha

  • Develop a module that adds a new content type with custom fieldsOctober 12

    How do I start to develop a Drupal 7 module that adds a new content type with some custom fields, so it generates all the output I want? --------------Solutions------------- Although its possible to do programatically, your easiest bet would be to us

  • SharePoint 2010 Get Content Type Programmatically

    SharePoint 2010 Get Content Type ProgrammaticallyJanuary 27

    I've created several content types that inherit from the document content type in the site content type lists. Please refer to the image below: How do I get these these content types programmatically? Basically what I want to do is to show these cont

  • creating content types with Out-of-Box vs Server Object modelsFebruary 23

    Are there any advantages in creating content type using out of box vs visual studios? --------------Solutions------------- I'm assuming that by "out of the box" you mean creating them in the User Interface. Advantages of Visual Studio Easy way t

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.804 s.