You are here

function ctools_context_entity_settings_form_submit in Chaos Tool Suite (ctools) 7

File

plugins/contexts/entity.inc, line 204
Plugin to provide a node context. A node context is a node wrapped in a context object that can be utilized by anything that accepts contexts.

Code

function ctools_context_entity_settings_form_submit($form, &$form_state) {
  if ($form_state['values']['set_identifier']) {
    $entity_info = entity_get_info($form_state['values']['entity_type']);
    $entity = entity_load($form_state['values']['entity_type'], array(
      $form_state['values']['entity_id'],
    ));
    $entity = $entity[$form_state['values']['entity_id']];
    $form_state['values']['identifier'] = $entity->{$entity_info['entity keys']['label']};
  }

  // This will either be the value set previously or a value set by the
  // validator.
  $form_state['conf']['entity_id'] = $form_state['values']['entity_id'];
}