You are here

function PartyDefaultDataSetUIAdd::action_form in Party 7

Same name and namespace in other branches
  1. 8.2 includes/party.data_ui.inc \PartyDefaultDataSetUIAdd::action_form()

Provides the action form for adding a new entity.

Parameters

$party: A loaded party object.

$data_set: A loaded data set. We don't actually need this loaded, but we need a menu loader to convert the path-style string to the machine name, and a menu loader that doesn't load would be weird too.

$eid: The id of the entity, if relevant to this action.

Overrides PartyDataSetActionInterface::action_form

1 method overrides PartyDefaultDataSetUIAdd::action_form()
PartyUserDataSetUIAdd::action_form in modules/party_user/includes/party_user.data_ui.inc
Provides the action form for attaching an existing user.

File

includes/party.data_ui.inc, line 95
Provides default classes for UI actions on data sets.

Class

PartyDefaultDataSetUIAdd
The 'add' action: attach a new entity.

Code

function action_form($form, &$form_state, $party, $data_set, $eid = NULL) {
  $form = array();
  $form_state['#attached_entity'] = $party
    ->getDataSetController($data_set['set_name'])
    ->createEntity();
  field_attach_form($data_set['entity type'], $form_state['#attached_entity'], $form, $form_state);
  $form['actions'] = array(
    '#type' => 'actions',
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Create new @label', array(
        '@label' => $data_set['label'],
      )),
    ),
  );
  return $form;
}