Hello everyone,
I have a problem with respect to the fields of a module created.
This module replaces the normal user registration drupal inserting custom fields that are different controls ....
Everything working perfectly !
But today I would like to be able to filter through a view that unfortunately these fields are parallel to the system Drupal .
That is, the module operates , the DB tables are well connected , but the fields written in the module are not visible within Drupal .
How can I get these fields of the custom module? I thought of declaring entity within the module but I have no idea how I can do .
Anyone has any other solutions ?
Thank you

Comments

Jaypan’s picture

Not entirely clear what the problem is.

mattyy21’s picture

I want show all my custom module fields within Drupal System.

Jaypan’s picture

Which part of the system? It's a big system.

mattyy21’s picture

Views.
I want show my fields in field view

Jaypan’s picture

That's not part of Drupal, that's a separate module.

You need to expose your fields/tables to views. You will need to implement hook_views_api() and hook_views_data().

http://www.sitepoint.com/exposing-tables-views-drupal-7/

mattyy21’s picture

otherwise if the call Entity , I can draw from the fields view ?
E.S.: Content: MY_CUSTOM_FIELD

Jaypan’s picture

I'm not sure what you are asking.

anshul.udapure’s picture

Use the following hook function to create custom fields which will appear in cck setings. you can enable it for each content type. It will appear in views as well

function examplehook_field_info() {

/**
code
*/
}

/**
* Implements hook_field_validate().
*
* Possible error codes:
* - 'codeformat_invalid': The email address is not valid
*/
function examplehook_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors) {

/**
* Implements hook_field_widget_error().
*/
functionexamplehook_field_widget_error($element, $error, $form, &$form_state) {
form_error($element, $error['message']);
}

/**
* Implements hook_content_is_empty().
*/
function examplehook_field_is_empty($item, $field) {
if (empty($item['codeformat'])) {

function examplehook_field_formatter_info() {
$formats = array(
'codeformat_default' => array(
'label' => t('Default format'),
'description' => t('Display code in formatted.'),
'field types' => array('codeformat'),
),

);

return $formats;
}

/**
* Implements hook_field_formatter_view().
*/
function examplehook_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display) {
$element = array();
module_load_include('inc', 'codeformat', 'geshifilter.pages');
switch ($display['type']) {
case 'codeformat_default':
foreach ($items as $delta => $item) {
/* print_r($item); */

$element[$delta] = array('#markup' => $item['codeformat']);
}
break;

}
return $element;
}

/**
* Implements hook_field_widget_info().
*/
function examplehook_field_widget_info() {
return array(
'codeformat_textfield' => array(
'label' => t('Text area'),
'field types' => array('examplehhok'),
'settings' => array('size' => 60),
),
);
}