1 entity_layout_context_handler.inc EntityLayoutContext::form(&$form, &$form_state)

Settings form for configuring this context item.

Overrides LayoutContext::form

File

core/modules/layout/plugins/context/entity_layout_context_handler.inc, line 43
Layout context handler for entities.

Class

EntityLayoutContext
@file Layout context handler for entities.

Code

function form(&$form, &$form_state) {
  parent::form($form, $form_state);

  $info = entity_get_info($this->entity_type);
  $input = isset($form_state['handler']->settings['id']) ? $form_state['handler']->settings['id'] : NULL;
  $form_state['input']['id'] = $input;
  $form['id'] = array(
    '#title' => t('Enter the ID of a @entity', array('@entity' => $info['label'])),
    '#type' => 'number',
    '#default_value' => $input,
    '#step' => 1,
    '#min' => 1,
    // @todo: Backdrop doesnt yet have a comprehensive entity autocomplete
    // function. We'd need to write a custom autocomplete function that
    // handles all entity types. This would be best as a core function
    // rather than just for this code.
    // '#autocomplete_path' => 'node/autocomplete',
    '#weight' => -10,
  );
}