public function gdpr_fields_ui::list_build_row in General Data Protection Regulation 7
Build a row based on the item.
By default all of the rows are placed into a table by the render method, so this is building up a row suitable for theme('table'). This doesn't have to be true if you override both.
Overrides ctools_export_ui::list_build_row
File
- modules/
gdpr_fields/ plugins/ export_ui/ gdpr_fields_ui.class.php, line 95 - Contains the CTools Export UI integration code.
Class
- gdpr_fields_ui
- CTools Export UI class handler for GDPR Fields UI.
Code
public function list_build_row($item, &$form_state, $operations) {
// Set up sorting.
/* @var GDPRFieldData $item */
$name = $item->{$this->plugin['export']['key']};
// @todo Abstract id property getter out of tasks module or require module.
$is_id = class_exists('Anonymizer') ? Anonymizer::propertyIsEntityId($item->entity_type, $item->property_name) : FALSE;
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
}
$row['data'] = array();
$row['class'] = !empty($item->disabled) ? array(
'ctools-export-ui-disabled',
) : array(
'ctools-export-ui-enabled',
);
// If we have an admin title, make it the first row.
$row['data'][] = array(
'data' => check_plain($item
->getSetting('label')),
'class' => array(
'ctools-export-ui-title',
),
);
$entity_info = entity_get_property_info($item->entity_type);
if ($info = field_info_field($item->property_name)) {
$type = $info['type'];
// Highlight entity reference fields.
if ($type == 'entityreference') {
$type = '<strong>' . $type . '</strong>';
}
}
else {
$type = 'property';
if (!empty($entity_info['properties'][$item->property_name]['type'])) {
$type .= ':' . $entity_info['properties'][$item->property_name]['type'];
}
// Highlight entity ids.
if ($is_id) {
$type = '<strong>primary_key</strong>';
}
}
$row['data'][] = array(
'data' => $type,
'class' => array(
'ctools-export-ui-field-type',
),
);
$rta_labels = $this
->rtaOptions();
$rtf_labels = $this
->rtfOptions();
$row['data'][] = array(
'data' => $rta_labels[$item
->getSetting('gdpr_fields_rta', '')],
'class' => array(
'ctools-export-ui-rta',
),
);
$rtf_label = $rtf_labels[$item
->getSetting('gdpr_fields_rtf', '')];
// Label id with removal as remove entity.
if ($is_id && $item
->getSetting('gdpr_fields_rtf', '') == 'remove') {
$rtf_label = t('Delete entire entity');
}
$row['data'][] = array(
'data' => $rtf_label,
'class' => array(
'ctools-export-ui-rtf',
),
);
$ops = theme('links__ctools_dropbutton', array(
'links' => $operations,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
));
$row['data'][] = array(
'data' => $ops,
'class' => array(
'ctools-export-ui-operations',
),
);
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$row['title'] = $item->{$this->plugin['export']['admin_description']};
}
$this->rows[$name] = $row;
}