You are here

function minisite_field_widget_process in Mini site 7

An element #process callback for the minisite field type.

1 string reference to 'minisite_field_widget_process'
minisite_field_widget_form in includes/minisite.field.inc
Implements hook_field_widget_form().

File

includes/minisite.field.inc, line 284
Minisite field.

Code

function minisite_field_widget_process($element, &$form_state, $form) {
  $item = $element['#value'];
  $item['fid'] = $element['fid']['#value'];
  $element['#theme'] = 'minisite_widget';

  // Specific settings in serialized data.
  $data = isset($item['data']) ? unserialize($item['data']) : [];

  // Allow minisite use page URL.
  $element['alias_status'] = [
    '#type' => 'checkbox',
    '#title' => t('Minisite URL alias (experimental)'),
    '#default_value' => empty($data['minisite_alias_status']) ? 0 : 1,
    '#description' => t('Optionally use current page URL (defined in URL path settings) as minisite base URL.'),
    '#weight' => -1,
    '#access' => (bool) $item['fid'],
  ];
  return $element;
}