You are here

public function MultipleEntityQueueHandler::subqueueForm in Entityqueue 7

Generates an add/edit subqueue form for this handler.

Overrides EntityQueueHandlerBase::subqueueForm

File

plugins/entityqueue/handler/MultipleEntityQueueHandler.class.php, line 16
Contains Entityqueue handler for simple queues with multiple subqueues.

Class

MultipleEntityQueueHandler
A multiple subqueue queue implementation.

Code

public function subqueueForm(EntitySubqueue $subqueue, &$form_state) {
  $values = (array) $subqueue;
  if (isset($form_state['values']) && !empty($form_state['values'])) {
    $values = $form_state['values'] + $values;
  }
  $form = array();
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Subqueue label'),
    '#required' => TRUE,
    '#default_value' => isset($values['label']) ? $values['label'] : '',
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#title' => t('Subqueue name'),
    '#required' => TRUE,
    '#default_value' => isset($values['name']) ? $values['name'] : '',
    '#machine_name' => array(
      'exists' => 'entityqueue_subqueue_load',
      'source' => array(
        'label',
      ),
    ),
    '#disabled' => isset($subqueue->subqueue_id),
  );
  return $form;
}