- πΊπΈUnited States dcam
Since Drupal 7 is now end-of-life I am closing some old issues for the 7.x branch of this module. If this issue is still relevant for the 3.x branch of the module, then feel free to reopen it.
I extended NodeInlineEntityFormController, and overriden method tableFields. Inside it I set the propery 'visible' => FALSE for field field_tc_other_relationship but it still shows.
I tried clearing cache, but it does not hide it.
I attached a screen shot
class NodeCustomController extends NodeInlineEntityFormController {
/**
* Returns an array of fields (which can be either Field API fields or
* properties defined through hook_entity_property_info()) that should be
* used to represent a selected entity in the IEF table.
*
* The IEF widget can have its own fields specified in the widget settings,
* in which case the output of this function is ignored.
*
* @param $bundles
* An array of allowed $bundles for this widget.
*
* @return
* An array of field information, keyed by field name. Allowed keys:
* - type: 'field' or 'property',
* - label: Human readable name of the field, shown to the user.
* - weight: The position of the field relative to other fields.
* - visible: Whether the field should be displayed.
* Special keys for type 'field':
* - formatter: The formatter used to display the field, or "hidden".
* - settings: An array passed to the formatter. If empty, defaults are used.
* - delta: If provided, limits the field to just the specified delta.
*/
public function tableFields($bundles) {
if($bundles[0] != "travel_companion"){
$fields = parent::tableFields($bundles);
}else{
$info = entity_get_info($this->entityType);
$metadata = entity_get_property_info($this->entityType);
$fields = array();
if (!empty($info['entity keys']['label'])) {
$label_key = $info['entity keys']['label'];
$fields[$label_key] = array(
'type' => 'field',
'label' => $metadata ? $metadata['properties'][$label_key]['label'] : t('Label'),
'visible' => TRUE,
'weight' => 1,
);
}
else {
$id_key = $info['entity keys']['id'];
$fields[$id_key] = array(
'type' => 'property',
'label' => $metadata ? $metadata['properties'][$id_key]['label'] : t('ID'),
'visible' => TRUE,
'weight' => 1,
);
}
if (count($bundles) > 1) {
$bundle_key = $info['entity keys']['bundle'];
$fields[$bundle_key] = array(
'type' => 'property',
'label' => $metadata ? $metadata['properties'][$bundle_key]['label'] : t('Type'),
'visible' => TRUE,
'weight' => 2,
);
}
// There, we add every single "CCK"-field the content type has
foreach($metadata['bundles'][$bundles[0]]['properties'] as $key => $property){
//dpm($property['label']);
if($key == "field_tc_birthday"){
$fields[$key] = array(
'type' => 'field',
'label' => $property['label'],
'visible' => true,
'formatter' => 'date_text',
'settings' => array(
'format_type' => 'short_visa_app'
)
);
}else if($key == 'field_tc_other_relationship'){
$fields[$key] = array(
'type' => 'property',
'label' => $property['label'],
'visible' => FALSE
);
}else{
$fields[$key] = array(
'type' => 'property',
'label' => $property['label'],
'visible' => TRUE,
);
}
}
unset($fields['title']);
$fields['field_tc_last_name']['weight'] = 3;
$fields['field_tc_middle_name']['weight'] = 4;
$fields['field_tc_first_name']['weight'] = 5;
$fields['field_tc_birthday']['weight'] = 6;
$fields['field_tc_gender']['weight'] = 7;
$fields['field_tc_marital_status2']['weight'] = 8;
$fields['field_tc_nationality2']['weight'] = 9;
$fields['field_tc_relationship']['weight'] = 10;
$fields['field_tc_other_relationship']['weight'] = 11;
}
dpm($fields);
return $fields;
}
Closed: outdated
1.5
Code
Since Drupal 7 is now end-of-life I am closing some old issues for the 7.x branch of this module. If this issue is still relevant for the 3.x branch of the module, then feel free to reopen it.