function _ief_table_view_mode_add_extra_field in Inline Entity Form Table View Mode 7
Same name and namespace in other branches
- 8.2 ief_table_view_mode.module \_ief_table_view_mode_add_extra_field()
- 8 ief_table_view_mode.module \_ief_table_view_mode_add_extra_field()
Add a new extra field in the table of the UI.
Parameters
array $element: The element with all fields.
string $name: The machine name of the extra field.
array $table_field: The definition of the field from ief.
array $display: The view setting of the field.
1 call to _ief_table_view_mode_add_extra_field()
File
- ./
ief_table_view_mode.module, line 250 - Defines a view mode to set up the columns of the table for the IEF widget.
Code
function _ief_table_view_mode_add_extra_field(array &$element, $name, array $table_field, array $display) {
$element[$name] = array(
'#attributes' => array(
'class' => array(
'draggable',
'tabledrag-leaf',
),
),
'#row_type' => 'extra_field',
'#region_callback' => 'field_ui_display_overview_row_region',
'#js_settings' => array(
'rowHandler' => 'field',
),
'human_name' => array(
'#markup' => check_plain($table_field['label']) . '*',
),
'weight' => array(
'#type' => 'textfield',
'#title' => t('Weight for @title', array(
'@title' => $table_field['label'],
)),
'#title_display' => 'invisible',
'#default_value' => $display['weight'],
'#size' => 3,
'#attributes' => array(
'class' => array(
'field-weight',
),
),
),
'parent_wrapper' => array(
'parent' => array(
'#type' => 'select',
'#title' => t('Parents for @title', array(
'@title' => $table_field['label'],
)),
'#title_display' => 'invisible',
'#options' => $element['#parent_options'],
'#empty_value' => '',
'#attributes' => array(
'class' => array(
'field-parent',
),
),
'#parents' => array(
'fields',
$name,
'parent',
),
),
'hidden_name' => array(
'#type' => 'hidden',
'#default_value' => $name,
'#attributes' => array(
'class' => array(
'field-name',
),
),
),
),
'empty_cell' => array(
'#markup' => ' ',
),
'format' => array(
'type' => array(
'#type' => 'select',
'#title' => t('Visibility for @title', array(
'@title' => $table_field['label'],
)),
'#title_display' => 'invisible',
'#options' => array(
'visible' => t('Visible'),
'hidden' => t('Hidden'),
),
'#default_value' => $display['visible'] ? 'visible' : 'hidden',
'#parents' => array(
'fields',
$name,
'type',
),
'#attributes' => array(
'class' => array(
'field-formatter-type',
),
),
),
),
'settings_summary' => array(),
'settings_edit' => array(),
);
}