* Relation endpoints field.
*/
-function relation_endpoints_field_info() {
+function relation_endpoint_field_info() {
return array(
'relation_endpoint' => array(
'label' => t('Relation endpoint'),
);
}
-function relation_endpoints_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
+function relation_endpoint_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
$relation_type = relation_type_load($entity->relation_type);
// Check that relation_type exists.
if (!$relation_type) {
/**
* Implements hook_field_presave().
*/
-function relation_endpoints_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
+function relation_endpoint_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
// We need r_index here because EntityFieldQuery can't query on deltas.
foreach ($items as $delta => &$item) {
$item['r_index'] = $delta;
/**
* Implements hook_field_update().
*/
-function relation_endpoints_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
+function relation_endpoint_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
// We do not update.
}
/**
* Implements hook_field_is_empty().
*/
-function relation_endpoints_field_is_empty($item, $field) {
+function relation_endpoint_field_is_empty($item, $field) {
// We are never empty.
return FALSE;
}
/**
* Helper to create an HTML table representing a relation.
*/
-function _relation_endpoints_field_create_html_table($endpoints) {
+function _relation_endpoint_field_create_html_table($endpoints) {
$list_items = array();
foreach ($endpoints as $delta => $endpoint) {
$entities = entity_load($endpoint['entity_type'], array($endpoint['entity_id']));
);
}
-function relation_endpoints_field_formatter_info() {
+function relation_endpoint_field_formatter_info() {
return array(
'relation_endpoint' => array(
'label' => t('Endpoints table'),
);
}
-function relation_endpoints_field_widget_info() {
+function relation_endpoint_field_widget_info() {
return array(
'relation_endpoint' => array(
'label' => t('Endpoints table'),
);
}
-function relation_endpoints_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
- return array(_relation_endpoints_field_create_html_table($items));
+function relation_endpoint_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
+ return array(_relation_endpoint_field_create_html_table($items));
}
-function relation_endpoints_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
+function relation_endpoint_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
foreach ($items as $delta => $item) {
foreach (array('entity_type', 'entity_id') as $column) {
$element[$delta][$column] = array(
);
}
}
- $element['link_list'] = _relation_endpoints_field_create_html_table($items);
+ $element['link_list'] = _relation_endpoint_field_create_html_table($items);
return $element;
}
/**
* Implements hook_form_field_ui_field_overview_form_alter().
*/
-function relation_endpoints_form_field_ui_field_overview_form_alter(&$form, $form_state) {
+function relation_endpoint_form_field_ui_field_overview_form_alter(&$form, $form_state) {
// Deleting endpoints would make the module useless.
if ($form['#entity_type'] == 'relation') {
$form['fields']['endpoints']['delete'] = array(