You are here

function panels_common_add_item_to_form in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/ \panels_common_add_item_to_form()

Add a row to the form. Used both in the main form and by the ajax to add an item.

3 calls to panels_common_add_item_to_form()
panels_common_add_item_table in includes/
Add the context table to the page.
panels_common_ajax_context_item_add in includes/
Ajax entry point to add an context
panels_common_ajax_context_item_edit in includes/
Ajax entry point to edit an item


includes/, line 763
Functions used by more than one panels client module.


function panels_common_add_item_to_form($type, &$form, $position, $item) {

  // This is the single function way to load any plugin by variable type.
  $info = panels_common_context_data($type, $item['name']);
  $form['title'] = array(
    '#value' => check_plain($item['identifier']),

  // Relationships not sortable.
  $type_info = panels_common_context_info($type);
  if (!empty($type_info['sortable'])) {
    $form['up'] = panels_add_button('go-up.png', t('Up'), t('Move this item up'), $type . '-up', $type . '-up-' . $position);
    $form['down'] = panels_add_button('go-down.png', t('Down'), t('Move this item down'), $type . '-down', $type . '-down-' . $position);
  $form['remove'] = panels_add_button('icon-delete.png', t('Remove'), t('Remove this item'), $type . '-remove', $type . '-remove-' . $position);
  $form['settings'] = panels_add_button('icon-configure.png', t('Configure'), t('Configure this item'), $type . '-settings', $type . '-settings-' . $position);