You are here

function _bricks_field_widget_elements in Bricks​ 7.5

Adds bricks' related fields into entityreference field widget.

Parameters

array $element Render element of the field widget.:

array $item Array of field property values to use as default values.:

2 calls to _bricks_field_widget_elements()
bricks_field_widget_form_alter in ./bricks.module
Implements hook_field_widget_form_alter().
bricks_inline_field_widget_form_alter in bricks_inline/bricks_inline.module
Implements hook_field_widget_form_alter().

File

./bricks.module, line 186

Code

function _bricks_field_widget_elements(&$element, $item) {
  $element['depth'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($item['depth']) ? $item['depth'] : 0,
    '#size' => 1,
  );
  $element['options'] = array(
    '#tree' => 'true',
    '#weight' => 11,
    'classes' => [
      '#type' => 'textfield',
      '#attributes' => array(
        'placeholder' => t('Additional CSS classes'),
      ),
      '#default_value' => !empty($item['options']['classes']) ? $item['options']['classes'] : '',
    ],
  );
}