Skip to content

Instantly share code, notes, and snippets.

@radheymkumar
Last active August 22, 2018 11:59
Show Gist options
  • Save radheymkumar/7a39563a26d54fa06b642c5bc495c6d8 to your computer and use it in GitHub Desktop.
Save radheymkumar/7a39563a26d54fa06b642c5bc495c6d8 to your computer and use it in GitHub Desktop.
dots_views_data()
function dots_views_data() {
// Group Dots Table
$data['dots_table']['table']['group'] = t('Dots Table');
$data['dots_table']['table']['base'] = array(
'field' => 'nid',
'title' => t('Dots Table'),
'help' => t('Example table contains example content and can be related to nodes.'),
'weight' => -10,
);
// Join Node
$data['dots_table']['table']['join'] = array(
'node' => array(
'left_field' => 'nid',
'field' => 'nid',
),
);
$data['dots_table']['node_id'] = array(
'title' => t('Dots node_id'),
'help' => t('Relate example content to the node content'),
'relationship' => array(
'base' => 'node_field_data',
'base field' => 'nid',
'id' => 'standard',
'label' => t('Dots node'),
),
);
// Join Users
$data['dots_table']['table']['join'] = array(
'users' => array(
'left_field' => 'uid',
'field' => 'uid',
),
);
$data['dots_table']['user_id'] = array(
'title' => t('Dots user_id'),
'help' => t('Relate example content to the node content'),
'relationship' => array(
'base' => 'users_field_data',
'base field' => 'uid',
'id' => 'standard',
'label' => t('Dots user'),
),
);
// Field Added
// Dots field, exposed as a field, sort, filter, and argument.
$data['dots_table']['id'] = array(
'title' => t('Dots ID'),
'help' => t('Just a numeric field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'numeric',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'standard',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'numeric',
),
'argument' => array(
// ID of argument handler plugin to use.
'id' => 'numeric',
),
);
$data['dots_table']['name'] = array(
'title' => t('Dots Name'),
'help' => t('Just a plain text field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'standard',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'standard',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'string',
),
'argument' => array(
// ID of argument handler plugin to use.
'id' => 'string',
),
);
$data['dots_table']['email'] = array(
'title' => t('Dots Email'),
'help' => t('Just a plain text field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'standard',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'standard',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'string',
),
'argument' => array(
// ID of argument handler plugin to use.
'id' => 'string',
),
);
$data['dots_table']['mobile'] = array(
'title' => t('Dots Mobile'),
'help' => t('Just a numeric field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'numeric',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'standard',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'numeric',
),
'argument' => array(
// ID of argument handler plugin to use.
'id' => 'numeric',
),
);
$data['dots_table']['dob'] = array(
'title' => t('Dots Dob'),
'help' => t('Just a timestamp field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'date',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'date',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'date',
),
);
$data['dots_table']['gender'] = array(
'title' => t('Dots Gender'),
'help' => t('Just a plain text field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'standard',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'standard',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'string',
),
'argument' => array(
// ID of argument handler plugin to use.
'id' => 'string',
),
);
$data['dots_table']['created'] = array(
'title' => t('Dots Created'),
'help' => t('Just a timestamp field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'date',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'date',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'date',
),
);
$data['dots_table']['changed'] = array(
'title' => t('Dots Changed'),
'help' => t('Just a timestamp field.'),
'field' => array(
// ID of field handler plugin to use.
'id' => 'date',
),
'sort' => array(
// ID of sort handler plugin to use.
'id' => 'date',
),
'filter' => array(
// ID of filter handler plugin to use.
'id' => 'date',
),
);
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment