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

    $form['category'] = array(
      '#type' => 'textfield',
      '#title' => t('Category'),
      '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'),
      '#default_value' => $form_state['item']->category,
    );

    $form['title'] = array(
      '#type' => 'textfield',
      '#default_value' => $form_state['item']->settings['title'],
      '#title' => t('Title'),
    );

    $form['body_field']['body'] = array(
      '#title' => t('Body'),
      '#type' => 'textarea',
      '#default_value' => $form_state['item']->settings['body'],
    );
    $parents[] = 'format';
    $form['body_field']['format'] = filter_form($form_state['item']->settings['format'], 1, $parents);

    $form['substitute'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use context keywords'),
      '#description' => t('If checked, context keywords will be substituted in this content.'),
      '#default_value' => !empty($form_state['item']->settings['substitute']),
    );
  }
 /**
  * Provide the actual editing form.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#description' => t('A human-readable title for the provider.'), '#size' => 32, '#maxlength' => 255, '#required' => TRUE, '#default_value' => $form_state['item']->title);
     $form['endpoint'] = array('#type' => 'textfield', '#title' => t('Endpoint'), '#description' => t('The endpoint where oEmbed requests are going to be sent.'), '#size' => 32, '#maxlength' => 255, '#required' => TRUE, '#default_value' => $form_state['item']->endpoint);
     $form['scheme'] = array('#type' => 'textarea', '#title' => t('Schemes'), '#description' => t('Newline separated list of schemes like !example', array('!example' => 'http://*.revision3.com/*')), '#required' => TRUE, '#default_value' => $form_state['item']->scheme);
 }
 /**
  * Provide the actual editing form.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $item = $form_state['item'];
     $form['info']['admin_title']['#required'] = TRUE;
     $form['info']['admin_title']['#maxlength'] = 80;
     $form['path'] = array('#type' => 'textarea', '#title' => t('Paths'), '#default_value' => $item->path, '#maxlength' => 128, '#size' => 45, '#description' => t('Specify pages by using their paths. Enter one path per line. The \'*\' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.', array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')), '#required' => TRUE);
     $form['help'] = array('#type' => 'textarea', '#title' => t('Help message'), '#default_value' => $item->help, '#description' => t('Specify a help message.'), '#required' => TRUE);
     $form['options'] = array('#type' => 'vertical_tabs');
     $form['options_roles'] = array('#type' => 'fieldset', '#title' => t('Roles'), '#collapsible' => TRUE, '#group' => 'options', '#weight' => -50);
     $item->options = unserialize($item->options);
     $roles = user_roles(FALSE, 'view custom help text');
     // Get all Authenticated roles
     if (isset($roles[DRUPAL_AUTHENTICATED_RID])) {
         $roles += array_diff(user_roles(TRUE), $roles);
     }
     if (user_access('administer permissions')) {
         $permission_link = l(t('View custom help text'), 'admin/people/permissions', array('fragment' => 'module-custom_help_text'));
     } else {
         $permission_link = t('View custom help text');
     }
     $form['options_roles']['roles'] = array('#type' => 'checkboxes', '#options' => $roles, '#title' => t('User roles that can view the custom help text'), '#required' => TRUE, '#description' => t('Check the roles that needs to view the help message and have currently the permission \'!permission_url\'.', array('!permission_url' => $permission_link)));
     if (!empty($item->options['roles'])) {
         foreach ($item->options['roles'] as $role_name) {
             if ($role = user_role_load_by_name($role_name)) {
                 $form['options_roles']['roles']['#default_value'][] = $role->rid;
             }
         }
     } else {
         $form['options_roles']['roles']['#default_value'] = array();
     }
 }
 /**
  * Adding or editing snippet
  * @param $form
  * @param $form_state
  */
 function edit_form(&$form, &$form_state)
 {
     // this is to show the preview
     $form['snippet_preview_wrapper'] = array('#prefix' => '<div id="snippet_preview">', '#suffix' => '</div>', '#markup' => '');
     // adding parent element
     parent::edit_form($form, $form_state);
     if ($form_state['form type'] == 'clone') {
         $default_snippet = $this->load_item($form_state['original name']);
     } elseif ($form_state['form type'] == 'add') {
         $default_snippet = $form_state['item'];
         $default_snippet->rid = NULL;
         $default_snippet->content = '';
     } else {
         $default_snippet = $form_state['item'];
     }
     // Needs to disable the admin_tile and name (machine name) fields
     // and delete button for editing snippet
     if ($form_state['op'] == 'edit') {
         $form['info']['admin_title']['#disabled'] = TRUE;
         $form['info']['name']['#disabled'] = TRUE;
         $form['buttons']['delete']['#access'] = FALSE;
     }
     $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#description' => t('Title for the textarea-exportible.'), '#default_value' => $default_snippet->rid ? $default_snippet->title_revision : $default_snippet->title);
     $form['content'] = array('#type' => 'text_format', '#title' => t('Content'), '#description' => t('Description of this snippet.'), '#default_value' => $default_snippet->content, '#format' => @$default_snippet->content_format);
     $form['preview'] = array('#type' => 'button', '#limit_validation_errors' => array(), '#value' => t('Preview'), '#submit' => array('snippet_build_preview'), '#ajax' => array('callback' => 'snippet_form_build_preview_callback', 'wrapper' => 'snippet_preview'), '#weight' => 101);
 }
 /**
  * Allow users to jump right into adding fields.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     if (module_exists('field_ui')) {
         $form['buttons']['save_continue'] = array('#type' => 'submit', '#value' => t('Save and add fields'), '#access' => $form_state['op'] == 'add' || $form_state['op'] == 'clone');
     }
 }
 /**
  * Implements ctools_export_ui::edit_form().
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $retrieve_plugins = mailhandler_get_plugins('mailhandler', 'retrieve');
     if (count($retrieve_plugins) == 1) {
         mailhandler_report('warning', 'No retrieval plugins are available. Please <a href="@module-page">enable a module</a> providing a retrieval plugin, such as the Mailhandler PHP IMAP module.', array('@module-page' => url('admin/modules')));
     }
     global $cookie_domain;
     extract($form_state['item']->settings);
     $form['info']['admin_title']['#description'] = t('Suggested, but not required, to be the email address of the mailbox.');
     $form['connection']['#tree'] = FALSE;
     $form['connection']['settings'] = array('#type' => 'fieldset', '#title' => 'Mailbox connection settings', '#tree' => TRUE, '#collapsible' => TRUE, '#after_build' => array('_mailhandler_include_js'));
     $form['connection']['settings']['type'] = array('#type' => 'select', '#title' => t('Protocol'), '#options' => array('imap' => 'IMAP', 'pop3' => 'POP3', 'local' => 'Local mbox file'), '#default_value' => $type, '#description' => t('You can use the IMAP/POP3 protocols, or retrieve from an mbox file on the local file system.'));
     $ajax_settings = array('callback' => '_mailhandler_mailbox_test', 'wrapper' => 'mailhandler_test_results', 'event' => 'change', 'progress' => array('type' => 'throbber', 'message' => t('Please wait - testing connection settings...')));
     $form['connection']['settings']['folder'] = array('#type' => 'textfield', '#title' => t('Folder'), '#default_value' => $folder, '#description' => t('The folder where the mail is stored. If you want this mailbox to read from a local mbox file, give an absolute path or the path relative to the Drupal installation directory.'), '#ajax' => $ajax_settings);
     $form['connection']['settings']['domain'] = array('#type' => 'textfield', '#title' => t('Domain'), '#default_value' => $domain ? $domain : trim($cookie_domain, '.'), '#description' => t('The domain of the server used to collect mail.'), '#ajax' => $ajax_settings);
     $form['connection']['settings']['port'] = array('#type' => 'textfield', '#title' => t('Port'), '#size' => 5, '#maxlength' => 5, '#default_value' => $port, '#description' => t('The mailbox port number (usually 110 for POP3, 143 for IMAP).'), '#element_validate' => array('element_validate_integer_positive'), '#ajax' => $ajax_settings);
     $form['connection']['settings']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $name, '#description' => t('This username is used while logging into this mailbox during mail retrieval.'), '#ajax' => $ajax_settings);
     $form['connection']['settings']['pass'] = array('#type' => 'textfield', '#title' => t('Password'), '#default_value' => $pass, '#description' => t('The password corresponding to the username above. Consider using a non-vital password, since this field is stored without encryption in the database.'), '#ajax' => $ajax_settings);
     // Allow administrators to configure the mailbox with extra IMAP commands (notls, novalidate-cert etc.)
     $form['connection']['settings']['extraimap'] = array('#type' => 'textfield', '#title' => t('Extra commands'), '#default_value' => $extraimap, '#description' => t('In some circumstances you need to issue extra commands to connect to your mail server (e.g. "/notls", "/novalidate-cert" etc.). See documentation for <a href="@imap-open">imap_open</a>.', array('@imap-open' => url('http://php.net/imap_open'))), '#ajax' => $ajax_settings);
     $form['connection']['settings']['results'] = array('#type' => 'container', '#attributes' => array('id' => 'mailhandler_test_results'));
     $form['extra']['#tree'] = FALSE;
     $form['extra']['settings'] = array('#type' => 'fieldset', '#title' => 'More settings', '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['extra']['settings']['limit'] = array('#type' => 'textfield', '#title' => t('Maximum messages to retrieve'), '#size' => 5, '#maxlength' => 5, '#default_value' => $limit, '#description' => t('To prevent timeout errors from large mailboxes you can limit the maximum number of messages that will be retrieved during each cron run. Set to zero for no limit.'), '#element_validate' => array('element_validate_integer'));
     $form['extra']['settings']['encoding'] = array('#type' => 'textfield', '#title' => t('Default character encoding'), '#default_value' => $encoding, '#description' => t('The default character encoding to use when an incoming message does not define an encoding.'));
     $form['extra']['settings']['flag_after_read'] = array('#type' => 'checkbox', '#title' => t('Mark messages as seen/read after they are processed?'), '#default_value' => isset($flag_after_read) ? $flag_after_read : TRUE, '#description' => t('Note that messages cannot be marked as seen/read for POP3 accounts.'));
     $form['extra']['settings']['delete_after_read'] = array('#type' => 'checkbox', '#title' => t('Delete messages after they are processed?'), '#default_value' => $delete_after_read, '#description' => t('Uncheck this box to leave read messages in the mailbox. They will not be processed again unless they become marked as unread.  If you selected "POP3" as your mailbox type, you must check this box.'));
     $form['extra']['settings']['fromheader'] = array('#type' => 'textfield', '#title' => t('From header'), '#default_value' => $fromheader, '#description' => t('Use this e-mail header to determine the author of the resulting node. <strong>Sender</strong> is useful when working with listservs.'));
     $form['extra']['settings']['security'] = array('#type' => 'radios', '#title' => t('Security'), '#options' => array(t('Disabled'), t('Require password')), '#default_value' => $security, '#description' => t('Disable security if your site does not require a password in the Commands section of incoming e-mails. Note: Security=Enabled and MIME preference=HTML is an unsupported combination.'));
     $form['extra']['settings']['replies'] = array('#type' => 'radios', '#title' => t('Send error replies'), '#options' => array(t('Disabled'), t('Enabled')), '#default_value' => $replies, '#description' => t('Send helpful replies to all unsuccessful e-mail submissions. Consider disabling when a listserv posts to this mailbox.'));
     $form['extra']['settings']['retrieve'] = array('#type' => 'select', '#title' => t('Retrieval library'), '#options' => _mailhandler_build_options($retrieve_plugins), '#default_value' => $retrieve, '#description' => t('The library that will be used to retrieve messages.'), '#required' => TRUE);
 }
 function edit_form(&$form, &$form_state)
 {
     // Get the basic edit form
     parent::edit_form($form, $form_state);
     $form['category'] = array('#type' => 'textfield', '#size' => 24, '#default_value' => $form_state['item']->category, '#title' => t('Category'), '#description' => t("The category that this mini-panel will be grouped into on the Add Content form. Only upper and lower-case alphanumeric characters are allowed. If left blank, defaults to 'Mini panels'."));
     $form['title']['#title'] = t('Title');
     $form['title']['#description'] = t('The title for this mini panel. It can be overridden in the block configuration.');
 }
Beispiel #8
0
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $item = $form_state['item'];
     $form['html'] = array('#type' => 'textarea', '#title' => t('HTML Code'), '#default_value' => $item->html, '#required' => TRUE, '#description' => t('Html code template.'), "#rows" => 20);
     $form['css'] = array('#type' => 'textarea', '#title' => t('Inline CSS'), '#default_value' => $item->css, '#required' => FALSE, '#description' => t('CSS code for template.'), "#rows" => 20);
     $form['ext_js'] = array('#type' => 'textarea', '#title' => t('External JS'), '#default_value' => $item->ext_js, '#required' => FALSE, '#description' => t('Add external Javascript files to template, each css link per line.'), "#rows" => 5);
     $form['ext_css'] = array('#type' => 'textarea', '#title' => t('External CSS'), '#default_value' => $item->ext_css, '#required' => FALSE, '#description' => t('Add external CSS files to template, each css link per line.'), "#rows" => 5);
 }
  /**
   * @see ctools_export_ui::edit_form()
   */
  function edit_form(&$form, &$form_state) {
    parent::edit_form($form, $form_state);
    $form['#attached']['js'] = array(
      drupal_get_path('module', 'uc_custom_payment') . '/plugins/export_ui/uc_custom_payment_ui.js',
    );
    $form['info']['admin_title']['#title'] = t('Name');
    $form['info']['admin_title']['#required'] = TRUE;
    $form['info']['admin_title']['#description'] = t('The name of this payment method as it will appear in administrative lists');
    $form['info']['name']['#machine_name']['exists'] = 'uc_custom_payment_name_exists';
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Title'),
      '#default_value' => empty($form_state['item']->title) ? '' : $form_state['item']->title,
      '#description' => t('The title of this payment method as it will appear to the customer.'),
      '#required' => TRUE,
    );
    $form['instructions'] = array(
      '#type' => 'text_format',
      '#title' => t('Instructions'),
      '#default_value' => empty($form_state['item']->instructions) ? '' : $form_state['item']->instructions['value'],
      '#format' => empty($form_state['item']->instructions) ? filter_default_format() : $form_state['item']->instructions['format'],
      '#description' => t('The instructions for this payment method which will appear when the method is selected.'),
    );
    if (module_exists('token')) {
      $form['instructions']['#description'] .= ' ' . t('You may use any of the following replacement patterns.');
      $form['instructions']['#suffix'] = theme('token_tree', array('token_types' => array('uc_order')));
    }

    $default = '';
    if (!empty($form_state['item']->data['service_charge'])) {
      $default = $form_state['item']->data['service_charge'];
      if ($form_state['item']->data['service_charge_type'] === 'percentage') {
        $default .= '%';
      }
    }
    $form['service_charge'] = array(
      '#type' => 'textfield',
      '#title' => t('Service Charge'),
      '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
      '#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
      '#default_value' => $default,
      '#description' => t('The service charge to be applied to the order when this payment method is selected.
        May be an absolute price or percent of order total (e.g. enter "15%"). Leave blank for no service charge.'),
    );
    $form['service_charge_title'] = array(
      '#type' => 'textfield',
      '#title' => t('Service Charge Title'),
      '#default_value' => empty($form_state['item']->data['service_charge_title']) ? t('Service charge') : $form_state['item']->data['service_charge_title'],
      '#description' => t('The line item title to use for the service charge.'),
      '#states' => array(
        'visible' => array(
          'input[name="service_charge"]' => array('filled' => TRUE),
        ),
      ),
    );
  }
 /**
  * Include some ctools stuff required for drupal ajax to work properly.
  * @see ctools_export_ui::edit_form()
  */
 public function edit_form(&$form, &$form_state)
 {
     // This is needed in order to get the ajax working in the ctools form.
     ctools_include('plugins');
     ctools_include('export');
     ctools_get_plugins('ctools', 'export_ui', 'entity_collection');
     parent::edit_form($form, $form_state);
     // We need to define our own function, the one provided by ctools does not
     // work with the Drupal ajax API.
     $form['info']['name']['#machine_name']['exists'] = 'entity_collection_bundle_exists';
 }
 function edit_form(&$form, &$form_state)
 {
     // Correct for an error that came in because filter format changed.
     if (is_array($form_state['item']->settings['body'])) {
         $form_state['item']->settings['format'] = $form_state['item']->settings['body']['format'];
         $form_state['item']->settings['body'] = $form_state['item']->settings['body']['value'];
     }
     parent::edit_form($form, $form_state);
     $form['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'), '#default_value' => $form_state['item']->category);
     $form['title'] = array('#type' => 'textfield', '#default_value' => $form_state['item']->settings['title'], '#title' => t('Title'));
     $form['body'] = array('#type' => 'text_format', '#title' => t('Body'), '#default_value' => $form_state['item']->settings['body'], '#format' => $form_state['item']->settings['format']);
     $form['substitute'] = array('#type' => 'checkbox', '#title' => t('Use context keywords'), '#description' => t('If checked, context keywords will be substituted in this content.'), '#default_value' => !empty($form_state['item']->settings['substitute']));
 }
 /**
  * Provide the actual editing form.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     // Add the buttons if the wizard is not in use.
     if (empty($form_state['form_info'])) {
         // Add buttons.
         $form['buttons']['submit']['#attributes'] = array('class' => array('enabled-for-ajax'));
         // Disable view display selection if a view has not been chosen.
         if (empty($form_state['values']['name'])) {
             $form['buttons']['submit']['#disabled'] = TRUE;
         }
     }
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $layer_types = openlayers_layer_types();
     $options = array('' => t('Select the layer type'));
     $layer = NULL;
     if ($form_state['op'] == 'edit' && $form_state['form type'] == 'edit') {
         $layer = openlayers_layer_load($form_state['item']->name);
     }
     if ($form_state['op'] == 'add' && $form_state['form type'] == 'clone') {
         $layer = openlayers_layer_load($form_state['function args'][2]->name);
         $layer->title = t('Clone of ') . $layer->title;
     }
     $form['info']['title'] = array('#id' => 'layertitle', '#type' => 'textfield', '#weight' => -1, '#title' => t('Layer Title'), '#default_value' => isset($layer->title) ? $layer->title : '', '#description' => t('The friendly name of your layer, which will appear in the administration interface as well on the map interface if it is exposed.'));
     $form['info']['name']['#machine_name']['source'] = array('info', 'title');
     $layers_options = array();
     // Go trough all layer types and get each options form.
     foreach ($layer_types as $layer_type) {
         if (is_object($layer) && get_class($layer) == $layer_type['layer_type']['class']) {
             // Layer is of current layer type.
             $layer_type_object = $layer;
         } else {
             // Otherwise load layer object for current layer type.
             $layer_type_object = openlayers_layer_type_load($layer_type['name']);
         }
         $layer_options_form = array();
         if (method_exists($layer_type_object, 'options_form')) {
             // This is because the class openlayers_layer_type
             // is not abstract.
             // Maybe there's a better way to do ?
             $parent = get_parent_class($layer_type_object);
             $parent_object = new $parent();
             $layer_options_form = $layer_type_object->options_form() + $parent_object->options_form($layer);
         }
         // TODO First case can never be true without crashing earlier
         if ($layer_type_object == FALSE || empty($layer_options_form)) {
             continue;
         }
         $layers_option = array('#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Layer specific options for @layer_title', array('@layer_title' => $layer_type['title'])));
         $layers_option += $layer_options_form;
         $layers_option['#states'] = array('visible' => array(':input[name="layer_type"]' => array('value' => $layer_type['name'])));
         $layers_option['layer_type'] = array('#type' => 'hidden', '#value' => $layer_type['name']);
         $layers_options[$layer_type['name']] = $layers_option;
         $options[$layer_type['name']] = $layer_type['title'];
     }
     $form['layer_type'] = array('#type' => 'select', '#title' => t('Layer Type'), '#default_value' => isset($layer->data['layer_type']) ? $layer->data['layer_type'] : '', '#description' => t('Select the type of layer.'), '#options' => $options);
     $form += $layers_options;
     $form['buttons']['submit']['#weight'] = 0;
     $form['buttons']['delete']['#weight'] = 20;
     $form['buttons']['saveandedit'] = array('#type' => 'submit', '#value' => t('Save and edit'), '#weight' => 10);
 }
 function edit_form(&$form, &$form_state)
 {
     // Get the basic edit form
     parent::edit_form($form, $form_state);
     // Set the admin title machine name length.
     // We need to do this because the system block name length is
     // limited to 32 chars.
     $form['info']['name']['#maxlength'] = 32;
     $form['info']['name']['#size'] = 34;
     $form['info']['name']['#description'] .= ' ' . t('The machine name length is limited to 32 characters, due to a limitation in the core block system.');
     $form['category'] = array('#type' => 'textfield', '#size' => 24, '#default_value' => $form_state['item']->category, '#title' => t('Category'), '#description' => t("The category that this mini-panel will be grouped into on the Add Content form. Only upper and lower-case alphanumeric characters are allowed. If left blank, defaults to 'Mini panels'."));
     $form['title']['#title'] = t('Title');
     $form['title']['#description'] = t('The title for this mini panel. It can be overridden in the block configuration.');
 }
 /**
  * {@inheritdoc}
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $preset = $form_state['item'];
     // Determine the currently selected entity type.
     $selected = isset($form_state['values']['entity_type']) ? $form_state['values']['entity_type'] : $preset->entity_type;
     // Disable form submission if an entity type has not been selected.
     if (empty($selected)) {
         $form['buttons']['submit']['#disabled'] = TRUE;
     }
     // Wrap the submit button in markup to allow it to be targeted with JS.
     $form['buttons']['submit']['#prefix'] = '<span id="save-button">';
     $form['buttons']['submit']['#suffix'] = '</span>';
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     // Hide internal identifier from user
     $form['info']['identifier']['#type'] = 'hidden';
     $form['info']['identifier']['#required'] = FALSE;
     $projectionData = $form_state['item'];
     $form['info']['authority'] = array('#id' => 'projectionauthority', '#type' => 'textfield', '#weight' => 1, '#title' => t('Projection Authority'), '#default_value' => $projectionData->authority, '#description' => t('Authority defining the projection'), '#required' => TRUE);
     $form['info']['code'] = array('#id' => 'projectioncode', '#type' => 'textfield', '#weight' => 2, '#title' => t('Projection Code'), '#default_value' => $projectionData->code, '#description' => t('Identifier (unique within authority)'), '#required' => TRUE);
     $form['info']['definition'] = array('#id' => 'projectiondefinition', '#type' => 'textarea', '#weight' => 3, '#title' => t('proj4 Definition'), '#default_value' => $projectionData->definition, '#description' => t('Description that can be used to handle rough conversions between coordinate systems. A correct definition is essential for coordinate displays or scale bars to work properly.'), '#required' => TRUE);
     $form['info']['projectedextentleft'] = array('#id' => 'projectionprojectedextentleft', '#type' => 'textfield', '#weight' => 4, '#title' => t('Left Extent Boundary'), '#default_value' => $projectionData->projectedextentleft, '#description' => t("Leftmost value in this projection's coordinates"), '#required' => TRUE);
     $form['info']['projectedextentbottom'] = array('#id' => 'projectionprojectedextentbottom', '#type' => 'textfield', '#weight' => 5, '#title' => t('Bottom Extent Boundary'), '#default_value' => $projectionData->projectedextentbottom, '#description' => t("Bottommost value in this projection's coordinates"), '#required' => TRUE);
     $form['info']['projectedextentright'] = array('#id' => 'projectionprojectedextentright', '#type' => 'textfield', '#weight' => 6, '#title' => t('Right Extent Boundary'), '#default_value' => $projectionData->projectedextentright, '#description' => t("Rightmost value in this projection's coordinates"), '#required' => TRUE);
     $form['info']['projectedextenttop'] = array('#id' => 'projectionprojectedextenttop', '#type' => 'textfield', '#weight' => 7, '#title' => t('Top Extent Boundary'), '#default_value' => $projectionData->projectedextenttop, '#description' => t("Topmost value in this projection's coordinates"), '#required' => TRUE);
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $form['tag'] = array('#type' => 'textarea', '#title' => t('Tag'), '#default_value' => $form_state['item']->tag);
     $form['placement'] = array('#type' => 'select', '#title' => t('Placement'), '#default_value' => $form_state['item']->settings['placement'], '#options' => _springboard_tag_placement_options());
     $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $form_state['item']->weight, '#delta' => 10, '#description' => t('Optional. Set a heavier value to have a tag rendered below others in the document.'));
     // Visibility options.
     $form['visibility'] = array('#type' => 'container', '#tree' => TRUE);
     // Fundraiser visibility options.
     $form['visibility']['fundraiser'] = array('#type' => 'fieldset', '#title' => t('Fundraiser Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#access' => module_exists('fundraiser'));
     $form['visibility']['fundraiser']['confirmation'] = array('#type' => 'checkbox', '#title' => t('Show only on donation form confirmation pages'), '#default_value' => $form_state['item']->settings['visibility']['fundraiser']['confirmation']);
     // Fundraiser visibility options.
     $form['visibility']['user'] = array('#type' => 'fieldset', '#title' => t('User Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#access' => module_exists('fundraiser'));
     $role_options = array_map('check_plain', user_roles());
     $form['visibility']['user']['roles'] = array('#type' => 'checkboxes', '#title' => t('Exclude tag for specific user roles'), '#default_value' => $form_state['item']->settings['visibility']['user']['roles'], '#options' => $role_options, '#description' => t('Exclude this tag for the selected role(s). If you select no roles, the tag will be visible to all users.'));
     // Per-path visibility.
     $form['visibility']['path'] = array('#type' => 'fieldset', '#title' => t('Path Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['visibility']['path']['page_specific'] = array('#type' => 'radios', '#title' => t('Include tag on specific pages'), '#options' => array(BLOCK_VISIBILITY_NOTLISTED => t('All pages except those listed'), BLOCK_VISIBILITY_LISTED => t('Only the listed pages')), '#default_value' => $form_state['item']->settings['visibility']['path']['page_specific']);
     $form['visibility']['path']['pages'] = array('#type' => 'textarea', '#title' => 'Pages', '#default_value' => $form_state['item']->settings['visibility']['path']['pages'], '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard."));
     // Per-node type visibility.
     $form['visibility']['node'] = array('#type' => 'fieldset', '#title' => t('Content Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['visibility']['node']['type'] = array('#type' => 'checkboxes', '#title' => t('Show tag for specific content types'), '#default_value' => $form_state['item']->settings['visibility']['node']['type'], '#options' => node_type_get_names(), '#description' => t('Show this tag only on nodes of the given type(s). If you select no types, there will be no type-specific limitation.'));
 }
  /**
   * Provide the actual editing form.
   */
  function edit_form(&$form, &$form_state) {
    parent::edit_form($form, $form_state);
    $form['width'] = array(
      '#type'          => 'textfield',
      '#size'          => 6,
      '#default_value' => $form_state['item']->width,
      '#title'         => t('Max width'),
      '#description'   => t('A maximum width in pixels of the embed or 0 for no maximum.'),
    );

    $form['height'] = array(
      '#type'          => 'textfield',
      '#size'          => 6,
      '#default_value' => $form_state['item']->height,
      '#title'         => t('Max height'),
      '#description'   => t('A maximum height in pixels of the embed or 0 for no maximum.'),
    );

    $form['disable_title'] = array(
      '#type'          => 'checkbox',
      '#default_value' => !empty($form_state['item']->conf['disable_title']),
      '#title'         => t('Disable title when other embeddable data is available'),
    );
  }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $module_path = drupal_get_path('module', 'slick');
     $optionset = $form_state['item'];
     $options = $optionset->options;
     $form['#attached']['css'][] = $module_path . '/css/admin/slick.admin--ui.css';
     $form['#attached']['css'][] = $module_path . '/css/admin/slick.admin--vertical-tabs.css';
     $form['#attached']['js'][] = $module_path . '/js/slick.admin.ui.js';
     $form['#attributes']['class'][] = 'no-js';
     $form['#attributes']['class'][] = 'form--slick';
     $form['#attributes']['class'][] = 'form--compact';
     $form['#attributes']['class'][] = 'form--optionset';
     $form['#attributes']['class'][] = 'clearfix';
     $form['info']['label']['#attributes']['class'][] = 'is-tooltip';
     $form['info']['name']['#attributes']['class'][] = 'is-tooltip';
     $form['info']['label']['#prefix'] = '<div class="form--slick__header has-tooltip clearfix">';
     // Skins.
     $skins = slick_skins(TRUE);
     $form['skin'] = array('#type' => 'select', '#title' => t('Skin'), '#options' => $skins, '#default_value' => $optionset->skin, '#description' => t('Skins allow swappable layouts like next/prev links, split image and caption, etc. Make sure to provide a dedicated slide layout per field. However a combination of skins and options may lead to unpredictable layouts, get dirty yourself. See main <a href="@skin">README.txt</a> for details on Skins.', array('@skin' => url($module_path . '/README.txt'))), '#attributes' => array('class' => array('is-tooltip')));
     $form['breakpoints'] = array('#title' => t('Breakpoints'), '#type' => 'textfield', '#description' => t('The number of breakpoints added to Responsive display.'), '#default_value' => isset($form_state['values']['breakpoints']) ? $form_state['values']['breakpoints'] : $optionset->breakpoints, '#suffix' => '</div>', '#ajax' => array('callback' => 'slick_add_breakpoints_ajax_callback', 'wrapper' => 'breakpoints-ajax-wrapper', 'event' => 'change'), '#attributes' => array('class' => array('is-tooltip')));
     // Options.
     $form['options'] = array('#type' => 'vertical_tabs', '#tree' => TRUE);
     // Image styles.
     $image_styles = image_style_options(FALSE);
     $form['options']['general'] = array('#type' => 'fieldset', '#title' => t('General'), '#attributes' => array('class' => array('has-tooltip', 'fieldset--no-checkboxes-label')));
     $form['options']['general']['normal'] = array('#type' => 'select', '#title' => t('Image style'), '#description' => t('Image style for the main/background image, overriden by field. Thumbnails are defined per field basis.'), '#empty_option' => t('None (original image)'), '#options' => $image_styles, '#default_value' => isset($options['general']['normal']) ? $options['general']['normal'] : '', '#attributes' => array('class' => array('is-tooltip')));
     /*
     @todo drop it or test elementTransition.js
     $form['options']['general']['transition'] = array(
       '#type' => 'select',
       '#title' => t('Transition effect'),
       '#description' => t('Custom CSS3 transition effect.'),
       '#empty_option' => t('- None -'),
       '#options' => _slick_transition_options(),
       '#default_value' => isset($options['general']['transition']) ? $options['general']['transition'] : '',
     );
     */
     $form['options']['general']['template_class'] = array('#type' => 'textfield', '#title' => t('Wrapper class'), '#description' => t('Additional template wrapper classes separated by spaces to gain more control per optionset.'), '#default_value' => isset($options['general']['template_class']) ? $options['general']['template_class'] : '', '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['goodies'] = array('#type' => 'checkboxes', '#title' => t('Goodies'), '#default_value' => !empty($options['general']['goodies']) ? array_values((array) $options['general']['goodies']) : array(), '#options' => array('pattern' => t('Use pattern overlay'), 'arrow-down' => t('Use arrow down')), '#description' => t('<ol><li>Pattern overlay is background image with pattern placed over the main stage.</li><li>Arrow down to scroll down into a certain page section, make sure to provide target selector.</li></ol>'), '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['arrow_down_target'] = array('#type' => 'textfield', '#title' => t('Arrow down target'), '#description' => t('Valid CSS selector to scroll to, e.g.: #main, or #content.'), '#default_value' => isset($options['general']['arrow_down_target']) ? $options['general']['arrow_down_target'] : '', '#states' => array('visible' => array(':input[name*=arrow-down]' => array('checked' => TRUE))), '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['arrow_down_offset'] = array('#type' => 'textfield', '#title' => t('Arrow down offset'), '#description' => t('Offset when scrolled down from the top.'), '#default_value' => isset($options['general']['arrow_down_offset']) ? $options['general']['arrow_down_offset'] : '', '#states' => array('visible' => array(':input[name*=arrow-down]' => array('checked' => TRUE))), '#attributes' => array('class' => array('is-tooltip')));
     // Add empty suffix to style checkboxes like iOS.
     foreach ($form['options']['general']['goodies']['#options'] as $key => $value) {
         $form['options']['general']['goodies'][$key]['#field_suffix'] = '';
         $form['options']['general']['goodies'][$key]['#title_display'] = 'before';
     }
     // Main options.
     $slick_options = slick_get_options();
     $form['options']['settings'] = array('#title' => t('Settings'), '#type' => 'fieldset', '#collapsible' => FALSE, '#tree' => TRUE, '#attributes' => array('class' => array('fieldset--settings', 'has-tooltip')));
     foreach ($slick_options as $name => $values) {
         $form['options']['settings'][$name] = array('#title' => $values['title'], '#description' => $values['description'], '#type' => $values['type'], '#default_value' => isset($options['settings'][$name]) ? $options['settings'][$name] : $values['default'], '#attributes' => array('class' => array('is-tooltip')));
         if (isset($values['field_suffix'])) {
             $form['options']['settings'][$name]['#field_suffix'] = $values['field_suffix'];
         }
         if ($values['type'] == 'textfield') {
             $form['options']['settings'][$name]['#size'] = 20;
             $form['options']['settings'][$name]['#maxlength'] = 255;
         }
         if (!isset($values['field_suffix']) && $values['cast'] == 'bool') {
             $form['options']['settings'][$name]['#field_suffix'] = '';
             $form['options']['settings'][$name]['#title_display'] = 'before';
         }
         if ($values['cast'] == 'int') {
             $form['options']['settings'][$name]['#maxlength'] = 60;
             $form['options']['settings'][$name]['#attributes']['class'][] = 'form-text--int';
         }
         if (isset($values['states'])) {
             $form['options']['settings'][$name]['#states'] = $values['states'];
         }
         if (isset($values['options'])) {
             $form['options']['settings'][$name]['#options'] = $values['options'];
         }
         if (isset($values['empty_option'])) {
             $form['options']['settings'][$name]['#empty_option'] = $values['empty_option'];
         }
         // Expand textfield for easy edit.
         if (in_array($name, array('prevArrow', 'nextArrow'))) {
             $form['options']['settings'][$name]['#attributes']['class'][] = 'js-expandable';
         }
     }
     // Responsive options.
     $form['options']['responsives'] = array('#title' => t('Responsive display'), '#type' => 'fieldset', '#description' => t('Containing breakpoints and settings objects. Settings set at a given breakpoint/screen width is self-contained and does not inherit the main settings, but defaults. Currently only supports Desktop first: starts breakpoint from the largest to smallest.'), '#collapsible' => FALSE, '#tree' => TRUE);
     $form['options']['responsives']['responsive'] = array('#title' => t('Responsive'), '#type' => 'fieldset', '#collapsible' => FALSE, '#attributes' => array('class' => array('has-tooltip', 'fieldset--responsive--ajax')), '#prefix' => '<div id="breakpoints-ajax-wrapper">', '#suffix' => '</div>');
     $breakpoints_count = isset($form_state['values']['breakpoints']) ? $form_state['values']['breakpoints'] : $optionset->breakpoints;
     $form_state['breakpoints_count'] = $breakpoints_count;
     if ($form_state['breakpoints_count'] > 0) {
         $slick_options = slick_get_responsive_options($form_state['breakpoints_count']);
         foreach ($slick_options as $i => $values) {
             if ($values['type'] == 'fieldset') {
                 $fieldset_class = drupal_clean_css_identifier(drupal_strtolower($values['title']));
                 $form['options']['responsives']['responsive'][$i] = array('#title' => $values['title'], '#type' => $values['type'], '#collapsible' => TRUE, '#collapsed' => TRUE, '#attributes' => array('class' => array('fieldset--responsive', 'fieldset--' . $fieldset_class, 'has-tooltip')));
                 foreach ($values as $key => $vals) {
                     if (is_array($vals)) {
                         if ($vals['type'] == 'fieldset') {
                             if (!isset($vals['default']) && $vals['type'] == 'fieldset') {
                                 $form['options']['responsives']['responsive'][$i][$key] = array('#title' => $vals['title'], '#type' => $vals['type'], '#collapsible' => FALSE, '#collapsed' => FALSE, '#attributes' => array('class' => array('fieldset--settings', 'fieldset--' . $fieldset_class, 'has-tooltip')));
                             }
                             foreach ($vals as $k => $value) {
                                 if ($value && is_array($value)) {
                                     $form['options']['responsives']['responsive'][$i][$key][$k] = array('#title' => $value['title'], '#description' => $value['description'], '#type' => $value['type'], '#attributes' => array('class' => array('is-tooltip')));
                                     if ($value['type'] != 'fieldset') {
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#default_value'] = isset($options['responsives']['responsive'][$i][$key][$k]) ? $options['responsives']['responsive'][$i][$key][$k] : $value['default'];
                                     }
                                     if (isset($value['states'])) {
                                         // Specify proper states for the breakpoint form elements.
                                         $states = '';
                                         switch ($k) {
                                             case 'pauseOnHover':
                                             case 'pauseOnDotsHover':
                                             case 'autoplaySpeed':
                                                 $states = array('visible' => array(':input[name*="options[responsives][responsive][' . $i . '][settings][autoplay]"]' => array('checked' => TRUE)));
                                                 break;
                                             case 'appendArrows':
                                                 $states = array('visible' => array(':input[name*="options[responsives][responsive][' . $i . '][settings][arrows]"]' => array('checked' => TRUE)));
                                                 break;
                                             case 'centerPadding':
                                                 $states = array('visible' => array(':input[name*="options[responsives][responsive][' . $i . '][settings][centerMode]"]' => array('checked' => TRUE)));
                                                 break;
                                             case 'touchThreshold':
                                                 $states = array('visible' => array(':input[name*="options[responsives][responsive][' . $i . '][settings][touchMove]"]' => array('checked' => TRUE)));
                                                 break;
                                         }
                                         if ($states) {
                                             $form['options']['responsives']['responsive'][$i][$key][$k]['#states'] = $states;
                                         }
                                     }
                                     if (isset($value['options'])) {
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#options'] = $value['options'];
                                     }
                                     if (isset($value['empty_option'])) {
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#empty_option'] = $value['empty_option'];
                                     }
                                     if (isset($value['field_suffix'])) {
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#field_suffix'] = $value['field_suffix'];
                                     }
                                     if (!isset($value['field_suffix']) && $value['cast'] == 'bool') {
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#field_suffix'] = '';
                                         $form['options']['responsives']['responsive'][$i][$key][$k]['#title_display'] = 'before';
                                     }
                                 }
                             }
                         } else {
                             $form['options']['responsives']['responsive'][$i][$key] = array('#title' => $vals['title'], '#description' => $vals['description'], '#type' => $vals['type'], '#default_value' => isset($options['responsives']['responsive'][$i][$key]) ? $options['responsives']['responsive'][$i][$key] : $vals['default'], '#attributes' => array('class' => array('is-tooltip')));
                             if ($vals['type'] == 'textfield') {
                                 $form['options']['responsives']['responsive'][$i][$key]['#size'] = 20;
                                 $form['options']['responsives']['responsive'][$i][$key]['#maxlength'] = 255;
                             }
                             if ($vals['cast'] == 'int') {
                                 $form['options']['responsives']['responsive'][$i][$key]['#maxlength'] = 60;
                             }
                             if (isset($vals['states'])) {
                                 $form['options']['responsives']['responsive'][$i][$key]['#states'] = $vals['states'];
                             }
                             if (isset($vals['options'])) {
                                 $form['options']['responsives']['responsive'][$i][$key]['#options'] = $vals['options'];
                             }
                             if (isset($vals['field_suffix'])) {
                                 $form['options']['responsives']['responsive'][$i][$key]['#field_suffix'] = $vals['field_suffix'];
                             }
                             if (!isset($vals['field_suffix']) && $vals['cast'] == 'bool') {
                                 $form['options']['responsives']['responsive'][$i][$key]['#field_suffix'] = '';
                                 $form['options']['responsives']['responsive'][$i][$key]['#title_display'] = 'before';
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $style = $form_state['item'];
     if (empty($style->name)) {
         $style = NULL;
     }
     module_load_include('inc', 'openlayers_ui', 'includes/openlayers_ui.styles');
     $properties = array('externalGraphic' => array('default' => '', 'desc' => t('The URL of an icon for points in a layer.  The following options are available:
     <ul><li>Full path, such as http://example.com/icon.png</li>
     <li>Relative Drupal path, such as sites/all/modules/example/icon.png</li>
     <li>Absolute path, such as /icon.png (though this is not suggested for maintainability reasons)</li></ul>'), 'maxlength' => 2083), 'imageStyle' => array('type' => 'select', 'title' => 'Image style', 'options' => array('' => 'None (original image)') + image_style_options(FALSE), 'default' => '', 'desc' => t('The Drupal Image Style to apply to the marker.')), 'pointRadius' => array('default' => 6, 'desc' => t('The radius of a vector point or the size of
     an icon. Note that, when using icons, this value should be half the
     width of the icon image.'), 'type' => 'integer'), 'fillColor' => array('default' => '#EE9900', 'desc' => t('This is the color used for
     filling in Polygons. It is also used in the center of marks for
     points: the interior color of circles or other shapes. It is
     not used if an externalGraphic is applied to a point.  This should be
     a hexadecimal value like #FFFFFF.')), 'strokeColor' => array('default' => '#EE9900', 'desc' => t('This is color of the line on features. On
     polygons and point marks, it is used as an outline to the feature.
     On lines, this is the representation of the feature.  This should be
     a hexadecimal value like #FFFFFF.')), 'strokeWidth' => array('default' => 1, 'desc' => t('This is width of the line on features. On
     polygons and point marks, it is used as an outline to
     the feature. On lines, this is the representation of the
     feature.  This is a value in pixels.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer_positive')), 'fillOpacity' => array('default' => 1, 'desc' => t('This is the opacity used for filling in Polygons.
     It is also used in the center of marks for points: the interior
     color of circles or other shapes. It is not used if an
     externalGraphic is applied to a point.  This should be a value
     between 0 and 1.'), 'type' => 'float', 'element_validate' => array('_element_validate_between_zero_and_one', 'element_validate_number')), 'strokeOpacity' => array('default' => 1, 'desc' => t('This is opacity of the line on features.
     On polygons and point marks, it is used as an outline to the
     feature. On lines, this is the representation of the feature.
     This should be a value between 0 and 1.'), 'type' => 'float', 'element_validate' => array('_element_validate_between_zero_and_one', 'element_validate_number')), 'strokeLinecap' => array('default' => 'round', 'desc' => t('Options are butt, round, square. This property
     is similar to the SVG stroke-linecap property. It determines
     what the end of lines should look like. See the SVG link for
     image examples.'), 'options' => array('butt' => t('Butt'), 'round' => t('Round'), 'square' => t('Square'))), 'strokeDashstyle' => array('default' => 'solid', 'desc' => t('Options are dot, dash, dashdot, longdash, longdashdot, solid.'), 'options' => array('dot' => t('Dot'), 'dash' => t('Dash'), 'dashdot' => t('Dash-dot'), 'longdash' => t('Long-dash'), 'longdashdot' => t('Long-dash-dot'), 'solid' => t('Solid'))), 'cursor' => array('default' => '', 'desc' => t('Cursor used when mouse is over the feature. Default
     is an empty string, which inherits from parent elements.  See
     <a href="!url">CSS cursor styles</a>.', array('!url' => 'http://www.w3schools.com/css/pr_class_cursor.asp'))), 'graphicWidth' => array('default' => '', 'desc' => t('This properties define the width of an externalGraphic.
     This is an alternative to the pointRadius symbolizer property
     to be used when your graphic has different sizes in the X and
     Y direction.  This should be in pixels.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer_positive')), 'graphicHeight' => array('default' => '', 'desc' => t('This properties define the height of an externalGraphic.
     This is an alternative to the pointRadius symbolizer property
     to be used when your graphic has different sizes in the X and
     Y direction.  This should be in pixels.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer_positive')), 'graphicOpacity' => array('default' => '1', 'desc' => t('Opacity of an external graphic.  This should be a
     value between 0 and 1. Graphics that are already semitransparent,
     like alpha PNGs, should have this set to 1, or rendering problems in
     Internet Explorer will ensue.'), 'type' => 'float', 'element_validate' => array('_element_validate_between_zero_and_one', 'element_validate_number')), 'graphicXOffset' => array('default' => '', 'desc' => t('Where the X value of the "center" of an
   externalGraphic should be.  This should be in pixels.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer')), 'graphicYOffset' => array('default' => '', 'desc' => t('Where the Y value of the "center" of an
   externalGraphic should be.  This should be in pixels.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer')), 'graphicName' => array('default' => '', 'desc' => t('Name of a type of symbol to be used
     for a point mark.')), 'rotation' => array('default' => '', 'desc' => t('The rotation angle in degrees clockwise for
     a point symbolizer.')), 'display' => array('default' => '', 'desc' => t('Can be set to "none" to hide features
     from rendering.'), 'options' => array('' => t('On'), 'none' => t('None (off)'))), 'label' => array('default' => '', 'desc' => t('A label to show for features. ' . 'Typically used with ${attribute} syntax.')), 'labelAlign' => array('default' => 'cm', 'desc' => t('Label alignment.'), 'options' => array('cm' => t('Center, middle'), 'ct' => t('Center, top'), 'cb' => t('Center, bottom'), 'lm' => t('Left, middle'), 'lt' => t('Left, top'), 'lb' => t('Left, bottom'), 'rm' => t('Right, middle'), 'rt' => t('Right, top'), 'rb' => t('Right, bottom'))), 'labelXOffset' => array('default' => '', 'desc' => t('Label X offset. Positive numbers move label right.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer')), 'labelYOffset' => array('default' => '', 'desc' => t('Label Y offset. Positive numbers move label up.'), 'type' => 'integer', 'element_validate' => array('element_validate_integer')), 'fontColor' => array('default' => '', 'desc' => t('Label font color.')), 'fontSize' => array('default' => '', 'desc' => t('Label font size.')), 'fontFamily' => array('default' => '', 'desc' => t('Label font family.')), 'fontWeight' => array('default' => '', 'desc' => t('Label font weight.')));
     // Provide a preview of the style
     if (isset($form_state['clicked_button']['#id']) && $form_state['clicked_button']['#id'] == 'edit-preview') {
         $preview_style = new stdClass();
         $preview_style->name = $form_state['values']['name'];
         $preview_style->title = $form_state['input']['title'];
         $preview_style->description = $form_state['input']['description'];
         $preview_style->data = $form_state['input']['data'];
         $form['info']['preview_style_container'] = array('#type' => 'item', '#title' => t('Preview'), '#markup' => openlayers_ui_style_preview($preview_style, TRUE), '#description' => t('If you are using attribute replacement, the style may not show properly.  The crosshairs point out where the feature is centered.'));
     }
     $form['info']['title'] = array('#id' => 'styletitle', '#type' => 'textfield', '#weight' => -1, '#title' => t('Style title'), '#default_value' => isset($style->title) ? $style->title : '', '#description' => t('The friendly name of your style, which will appear in the administration interface as well on the map interface.'));
     $form['info']['name']['#machine_name']['source'] = array('info', 'title');
     // OpenLayers style properties
     $form['data'] = array('#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Style Properties'), '#description' => t('The specific properties for the style.'));
     foreach ($properties as $key => $prop) {
         $form['data'][$key] = array('#type' => !isset($prop['options']) ? 'textfield' : 'select', '#title' => !isset($prop['title']) ? check_plain($key) : check_plain($prop['title']), '#description' => filter_xss($prop['desc']), '#default_value' => isset($style->data[$key]) ? $style->data[$key] : $prop['default'], '#element_validate' => isset($prop['element_validate']) ? $prop['element_validate'] : array(), '#element_validate' => isset($prop['element_validate']) ? $prop['element_validate'] : array());
         // Add options if needed
         if (isset($prop['options']) && is_array($prop['options'])) {
             $form['data'][$key]['#options'] = $prop['options'];
         }
         // Add maxlength if needed
         if (isset($prop['maxlength']) && is_numeric($prop['maxlength'])) {
             $form['data'][$key]['#maxlength'] = $prop['maxlength'];
         }
     }
     // Add preview button.
     $form['buttons']['preview'] = array('#type' => 'button', '#value' => t('Preview'));
 }
 /**
  * Extends ctools_export_ui::edit_form().
  *
  * Change the 'exists' callback so that we can build the actual export object
  * name before checking if it exists.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     foreach ($form['info'] as $export_key => $settings) {
         if (!empty($form['info'][$export_key]['#machine_name']['exists'])) {
             $form['info'][$export_key]['#machine_name']['exists'] = 'panelizer_defaults_ui_edit_name_exists';
         }
     }
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     // Customize edit form for our preferences.
     $form['info']['label']['#title'] = t('Label');
     $form['info']['label']['#size'] = 30;
     $form['info']['name']['#size'] = 30;
     $form['info']['description']['#rows'] = 2;
     $form['info']['description']['#resizable'] = FALSE;
     // Add the Category form element.
     $form['info']['category'] = array('#type' => 'textfield', '#size' => 24, '#default_value' => $form_state['item']->category, '#title' => t('Category'), '#description' => t('What category this layout should appear in. If left blank the category will be "Miscellaneous".'));
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $style = $form_state['item'];
     if (empty($style->name)) {
         $style = NULL;
     }
     module_load_include('inc', 'openlayers_ui', 'includes/openlayers_ui.styles');
     $properties = array('externalGraphic' => array('default' => '', 'desc' => t('The URL of an icon for points in a layer.  The following options are available:
     <ul><li>Full path, such as http://example.com/icon.png</li>
     <li>Relative Drupal path, such as sites/all/modules/example/icon.png</li>
     <li>Absolute path, such as /icon.png (though this is not suggested for maintainability reasons)</li></ul>'), 'maxlength' => 2083), 'backgroundGraphic' => array('default' => '', 'desc' => t('Url to a graphic to be used as the background under an externalGraphic.'), 'maxlength' => 2083), 'backgroundGraphicZIndex' => array('default' => '', 'desc' => t('The integer z-index value to use in rendering the background graphic.')), 'backgroundXOffset' => array('default' => '', 'desc' => t('The x offset (in pixels) for the background graphic.')), 'backgroundYOffset' => array('default' => '', 'desc' => t('The y offset (in pixels) for the background graphic.')), 'backgroundHeight' => array('default' => '', 'desc' => t('The height of the background graphic.  If not provided, the graphicHeight will be used.')), 'backgroundWidth' => array('default' => '', 'desc' => t('The width of the background width.  If not provided, the graphicWidth will be used.')), 'pointRadius' => array('default' => 6, 'desc' => t('The radius of a vector point or the size of
     an icon. Note that, when using icons, this value should be half the
     width of the icon image.')), 'fillColor' => array('default' => '#EE9900', 'desc' => t('This is the color used for
     filling in Polygons. It is also used in the center of marks for
     points: the interior color of circles or other shapes. It is
     not used if an externalGraphic is applied to a point.  This should be
     a hexadecimal value like #FFFFFF.')), 'fillOpacity' => array('default' => 1, 'desc' => t('This is the opacity used for filling in Polygons.
     It is also used in the center of marks for points: the interior
     color of circles or other shapes. It is not used if an
     externalGraphic is applied to a point.  This should be a value
     between 0 and 1.')), 'strokeColor' => array('default' => '#EE9900', 'desc' => t('This is color of the line on features. On
     polygons and point marks, it is used as an outline to the feature.
     On lines, this is the representation of the feature.  This should be
     a hexadecimal value like #FFFFFF.')), 'strokeWidth' => array('default' => 1, 'desc' => t('This is width of the line on features. On
     polygons and point marks, it is used as an outline to
     the feature. On lines, this is the representation of the
     feature.  This is a value in pixels.')), 'strokeOpacity' => array('default' => 1, 'desc' => t('This is opacity of the line on features.
     On polygons and point marks, it is used as an outline to the
     feature. On lines, this is the representation of the feature.
     This should be a value between 0 and 1.')), 'strokeLinecap' => array('default' => 'round', 'desc' => t('Options are butt, round, square. This property
     is similar to the SVG stroke-linecap property. It determines
     what the end of lines should look like. See the SVG link for
     image examples.'), 'options' => array('butt' => t('Butt'), 'round' => t('Round'), 'square' => t('Square'))), 'strokeDashstyle' => array('default' => 'solid', 'desc' => t('Options are dot, dash, dashdot, longdash, longdashdot, solid.'), 'options' => array('dot' => t('Dot'), 'dash' => t('Dash'), 'dashdot' => t('Dash-dot'), 'longdash' => t('Long-dash'), 'longdashdot' => t('Long-dash-dot'), 'solid' => t('Solid'))), 'cursor' => array('default' => '', 'desc' => t('Cursor used when mouse is over the feature. Default
     is an empty string, which inherits from parent elements.  See
     <a href="!url">CSS cursor styles</a>.', array('!url' => 'http://www.w3schools.com/css/pr_class_cursor.asp'))), 'graphicWidth' => array('default' => '', 'desc' => t('This properties define the width of an externalGraphic.
     This is an alternative to the pointRadius symbolizer property
     to be used when your graphic has different sizes in the X and
     Y direction.  This should be in pixels.')), 'graphicHeight' => array('default' => '', 'desc' => t('This properties define the height of an externalGraphic.
     This is an alternative to the pointRadius symbolizer property
     to be used when your graphic has different sizes in the X and
     Y direction.  This should be in pixels.')), 'graphicOpacity' => array('default' => '1', 'desc' => t('Opacity of an external graphic.  This should be a
     value between 0 and 1. Graphics that are already semitransparent,
     like alpha PNGs, should have this set to 1, or rendering problems in
     Internet Explorer will ensue.')), 'graphicXOffset' => array('default' => '', 'desc' => t('Where the X value of the "center" of an
   externalGraphic should be.  This should be in pixels.')), 'graphicYOffset' => array('default' => '', 'desc' => t('Where the Y value of the "center" of an
   externalGraphic should be.  This should be in pixels.')), 'graphicName' => array('default' => '', 'desc' => t('Name of a type of symbol to be used
     for a point mark.')), 'graphicZIndex' => array('default' => '', 'desc' => t('The integer z-index value to use in rendering.')), 'rotation' => array('default' => '', 'desc' => t('The rotation angle in degrees clockwise for
     a point symbolizer.')), 'display' => array('default' => '', 'desc' => t('Can be set to "none" to hide features
     from rendering.'), 'options' => array('' => t('On'), 'none' => t('None (off)'))), 'title' => array('default' => '', 'desc' => t('Tooltip when hovering over a feature.  Not supported by the canvas renderer.')), 'label' => array('default' => '', 'desc' => t('The text for an optional label. For browsers that use the canvas renderer, this requires either fillText or mozDrawText to be available. Typically used with ${attribute} syntax.')), 'labelAlign' => array('default' => 'cm', 'desc' => t('Label alignment.'), 'options' => array('cm' => t('Center, middle'), 'ct' => t('Center, top'), 'cb' => t('Center, bottom'), 'lm' => t('Left, middle'), 'lt' => t('Left, top'), 'lb' => t('Left, bottom'), 'rm' => t('Right, middle'), 'rt' => t('Right, top'), 'rb' => t('Right, bottom'))), 'labelXOffset' => array('default' => '', 'desc' => t('Label X offset. Positive numbers move label right.')), 'labelYOffset' => array('default' => '', 'desc' => t('Label Y offset. Positive numbers move label up.')), 'fontColor' => array('default' => '', 'desc' => t('The font color for the label, to be provided like CSS.')), 'fontOpacity' => array('default' => '', 'desc' => t('Opacity (0-1) for the label')), 'fontFamily' => array('default' => '', 'desc' => t('The font family for the label, to be provided like in CSS.')), 'fontSize' => array('default' => '', 'desc' => t('The font size for the label, to be provided like in CSS.')), 'fontStyle' => array('default' => '', 'desc' => t('The font style for the label, to be provided like in CSS.')), 'fontWeight' => array('default' => '', 'desc' => t('The font weight for the label, to be provided like in CSS.')));
     $form['info']['title'] = array('#id' => 'styletitle', '#type' => 'textfield', '#weight' => -1, '#title' => t('Style title'), '#default_value' => isset($style->title) ? $style->title : '', '#description' => t('The friendly name of your style, which will appear in the administration interface as well on the map interface.'));
     $form['info']['name']['#machine_name']['source'] = array('info', 'title');
     $fields = array();
     $views = views_get_all_views();
     foreach ($views as $vid => $view) {
         if (isset($view->display)) {
             foreach ($view->display as $vdid => $display) {
                 if (isset($display->display_options)) {
                     if (isset($display->display_options['style_plugin'])) {
                         if ($display->display_options['style_plugin'] == 'openlayers_data') {
                             foreach ($display->display_options['fields'] as $fid => $fdata) {
                                 $fields[] = t('<code>@fid</code> <em>(from view @viewname and display @displayname.)</em>', array('@fid' => '${' . $fid . '}', '@viewname' => $view->name, '@displayname' => $vdid));
                             }
                         }
                     }
                 }
             }
         }
     }
     $form['available_fields'] = array('#type' => 'fieldset', '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => t('Available fields to use as token'), '#description' => t('Notice: Since OpenLayers beta 9, the rendering of
     . the fields has changed, it\'s not using the raw value of the field,
     . but the full row rendering. You must disable all the HTML element by
     . selecting None in the Style setting fieldset of the field in Views or
     . you might get a mix of HTML with the raw value of the field.'));
     if ($fields) {
         $form['available_fields']['fields'] = array('#markup' => theme('item_list', array('items' => $fields)));
     } else {
         $form['available_fields']['fields'] = array('#prefix' => '<p class="no-fields-message">', '#markup' => t('There are no available fields to use as tokens.'), '#suffix' => '</p>');
         $form['available_fields']['fields_instruction'] = array('#access' => user_access('administer views'), '#prefix' => '<p class="no-fields-instruction">', '#markup' => t('Go to the <a !attributes>Views administration</a> page and create an "OpenLayers Data Overlay" display.', array('!attributes' => drupal_attributes(array('href' => url('admin/structure/views'))))), '#suffix' => '</p>');
     }
     // OpenLayers style properties
     $form['data'] = array('#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Style Properties'), '#description' => t('The specific properties for the style.'));
     foreach ($properties as $key => $prop) {
         $form['data'][$key] = array('#type' => !isset($prop['options']) ? 'textfield' : 'select', '#title' => !isset($prop['title']) ? check_plain($key) : check_plain($prop['title']), '#description' => filter_xss($prop['desc']), '#default_value' => isset($style->data[$key]) ? $style->data[$key] : $prop['default'], '#element_validate' => isset($prop['element_validate']) ? $prop['element_validate'] : array(), '#element_validate' => isset($prop['element_validate']) ? $prop['element_validate'] : array());
         // Add options if needed
         if (isset($prop['options']) && is_array($prop['options'])) {
             $form['data'][$key]['#options'] = $prop['options'];
         }
         // Add maxlength if needed
         if (isset($prop['maxlength']) && is_numeric($prop['maxlength'])) {
             $form['data'][$key]['#maxlength'] = $prop['maxlength'];
         }
     }
     // Add preview button.
     $form['buttons']['preview'] = array('#type' => 'button', '#value' => t('Preview'));
 }
 /**
  * Implements edit_form().
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $this->_edit_form($form, $form_state);
 }
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $map = $form_state['item'];
     if (empty($map->name)) {
         $map = NULL;
     }
     module_load_include('inc', 'openlayers_ui', 'includes/openlayers_ui.maps');
     openlayers_include();
     ctools_include('dependent');
     drupal_add_js(drupal_get_path('module', 'openlayers_ui') . '/js/openlayers_ui.maps.js');
     drupal_add_css(drupal_get_path('module', 'openlayers_ui') . '/openlayers_ui.css');
     // If cloning or editing, attempt to get map.
     $defaults = array();
     if (empty($map)) {
         $default_map = openlayers_map_load(variable_get('openlayers_default_map', 'default'));
         if ($default_map) {
             $defaults = $default_map->data;
         }
     } else {
         $defaults = $map->data;
     }
     $defaults['projection'] = openlayers_get_projection_by_identifier($defaults['projection']);
     $defaults['displayProjection'] = openlayers_get_projection_by_identifier($defaults['displayProjection']);
     // Map preview.  It's a little in the way, so we allow the user
     // to turn it on or off.  Show on preview, otherwise look at setting.
     // Might want to look at disableing the mousewheel zoom since
     // the map could be very in the way.
     if (isset($form_state['clicked_button']['#id']) && $form_state['clicked_button']['#id'] == 'edit-buttons-preview' || variable_get('openlayers_ui_preview_map', FALSE)) {
         $map_preview = isset($form_state['values']) ? openlayers_ui_maps_form_process($form_state['values']) : $map;
         $form['preview'] = array('#tree' => FALSE, '#type' => 'fieldset', '#title' => t('Preview'), '#description' => t('The following is a preview of your map.  Click <em>Preview</em>
     to refresh the map with the new values.  ' . (!variable_get('openlayers_ui_preview_map', FALSE) ? t('Turn map previews on by default on the !link.', array('!link' => l(t('Settings page'), 'admin/structure/openlayers/settings'))) : '')));
         $form['preview']['map'] = array('#markup' => openlayers_render_map($map_preview));
     } else {
         $form['preview'] = array();
         $form['preview']['map'] = array('#markup' => '<p>' . t('Turn map previews on by default on the !link.', array('!link' => l(t('Settings page'), 'admin/structure/openlayers/settings'))) . '</p>');
     }
     // Utilize vertical tabs for a better interface.
     $form['ui'] = array('#type' => 'vertical_tabs', '#default_tab' => 'info');
     // General map information.
     $form['info']['#type'] = 'fieldset';
     $form['info']['#group'] = 'ui';
     $form['info']['#title'] = 'Infos';
     $form['info']['title'] = array('#id' => 'maptitle', '#type' => 'textfield', '#title' => t('Map Title'), '#description' => t('This is the descriptive title of the map and will show up most often in the interface.'), '#maxlength' => 255, '#default_value' => !empty($map->title) ? $map->title : '', '#required' => TRUE, '#weight' => -1);
     $form['info']['name']['#machine_name']['source'] = array('info', 'title');
     $form['info']['width'] = array('#type' => 'textfield', '#title' => t('Width'), '#description' => t('The map\'s width. "auto" will make the map fill
   the space it is given; otherwise, enter a value in pixels, like 400px.'), '#default_value' => !empty($defaults['width']) ? $defaults['width'] : '', '#maxlength' => 128, '#required' => TRUE);
     $form['info']['height'] = array('#type' => 'textfield', '#title' => t('Height'), '#description' => t('The map\'s height. Enter a value in pixels,
   like 400px.'), '#default_value' => !empty($defaults['height']) ? $defaults['height'] : '', '#maxlength' => 128, '#required' => TRUE);
     // Only show this if Openlayers Views is enabled
     if (module_exists('openlayers_views')) {
         $form['info']['hide_empty_map'] = array('#type' => 'checkbox', '#title' => t('Hide empty map for Views'), '#description' => t("Show views empty text or hide the map if there are\n        no map overlays with features. Otherwise an empty map is displayed."), '#default_value' => isset($defaults['hide_empty_map']) ? $defaults['hide_empty_map'] : FALSE);
     }
     $default_image_path = drupal_get_path('module', 'openlayers') . '/themes/default_dark/img/';
     $form['info']['image_path'] = array('#type' => 'textfield', '#title' => t('Image Path'), '#description' => t('<p>The path to a directory of UI graphics. Use any of the
   following:</p>
   <ul>
     <li><strong>Leave blank</strong> for default graphics as provided
       by the OpenLayers library. </li>
     <li><strong>Relative Drupal path</strong> a path without leading slash and
       the base path will be prepended, ex. "sites/all/themes/path/to/images/"</li>
     <li><strong>Absolute path</strong> a path with leading slash and path will
       start from sites root directory, ex. "/path/to/images/"</li>
     <li><strong>Full URL</strong> such as "http://example.com/image/"</li>
   </ul>
   <p>Always include trailing slash.  The default path provided with this module
   is: %default</p>
   <p><strong>This is actually a setting for the OpenLayers
   object and will affect all maps on the same page.</strong></p>', array('%default' => $default_image_path)), '#default_value' => !empty($defaults['image_path']) ? $defaults['image_path'] : '');
     $default_css_path = drupal_get_path('module', 'openlayers') . '/themes/default_dark/style.css';
     $form['info']['css_path'] = array('#type' => 'textfield', '#title' => t('CSS Path'), '#description' => t('<p>The path to a CSS file for overriding CSS. You
   don\'t really need to override this as CSS is almost always overridable.
   Use any of the following:</p>
   <ul>
     <li><strong>Leave blank</strong> for default hosted OpenLayers which
       is !link</li>
     <li><strong>Relative Drupal path</strong> a path without leading slash and
       the base path will be prepended, ex. "sites/all/themes/path/to/style.css"</li>
     <li><strong>Absolute path</strong> a path with leading slash and path will
       start from sites root directory, ex. "/path/to/style.css"</li>
     <li><strong>Full URL</strong> such as "http://example.com/style.css"</li>
   </ul>
   <p>The default path provided with this module
   is: %default</p>
   <p><strong>This is actually a setting for the OpenLayers
   object and will affect all maps on the same page.</strong></p>', array('!link' => l('http://openlayers.org/api/theme/default/style.css', 'http://openlayers.org/api/theme/default/style.css'), '%default' => $default_css_path)), '#default_value' => !empty($defaults['css_path']) ? $defaults['css_path'] : '');
     $form['info']['proxy_host'] = array('#type' => 'textfield', '#title' => t('Proxy Host'), '#description' => t('<p>A proxy (typically on the same domain as this site)
   which enables requests to cross-domain AJAX resources (including remote
   KML).  Use any of the following:</p>
   <ul>
     <li><strong>Leave blank</strong> no proxy path.</li>
     <li><strong>Relative Drupal path</strong> a path without leading slash and
       the base path will be prepended, ex. "proxy?request="</li>
     <li><strong>Absolute path</strong> a path with leading slash and path will
       start from sites root directory, ex. "/cgi_proxy?request="</li>
     <li><strong>Full URL</strong> such as "http://example.com/proxy?request="</li>
   </ul>
   <p><strong>This is actually a setting for the OpenLayers
   object and will affect all maps on the same page.</strong></p>'), '#default_value' => !empty($defaults['proxy_host']) ? $defaults['proxy_host'] : '');
     // Center
     $form['center'] = array('#title' => t('Center & Bounds'), '#description' => t('Where the map will center itself initially.
   <strong>Shift-drag</strong> a box on the map to set the Restricted Extent.'), '#tree' => TRUE, '#type' => 'fieldset', '#group' => 'ui');
     $form['center']['helpmap'] = array('#markup' => '<div class="form-item openlayers-center-helpmap"
   style="display:block">' . openlayers_ui_maps_form_center_map($defaults) . '</div>');
     $form['center']['initial'] = array('#type' => 'fieldset', '#title' => t('Initial Map View'));
     $form['center']['initial']['centerpoint'] = array('#type' => 'textfield', '#title' => t('Centerpoint'), '#description' => t('Coordinates that are the intial focus of the map.  This
   is formated like <em>longitude,latitude</em>.'), '#default_value' => $defaults['center']['initial']['centerpoint'], '#attributes' => array('class' => array('openlayers-form-centerpoint')), '#size' => 25);
     $form['center']['initial']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom Level'), '#description' => t('Initial Zoom Level when the map intially displays.
   Higher is more zoomed in.'), '#default_value' => $defaults['center']['initial']['zoom'], '#attributes' => array('class' => array('openlayers-form-zoom')), '#size' => 25);
     $form['center']['restrict'] = array('#type' => 'fieldset', '#title' => t('Restrict Extent'));
     $form['center']['restrict']['restrictextent'] = array('#type' => 'checkbox', '#title' => t('Restrict Extent'), '#description' => t('Setting the restricted extent of a map prevents users
   from panning the map outside a specified area. This can be set
   interactively by <strong>holding the shift key and dragging a box</strong> over the map
   above. Setting the extent does not restrict how far users can zoom out,
   so setting restricted zoom levels (via individual layer settings) is
   recommended.'), '#id' => 'restrictextent', '#default_value' => isset($defaults['center']['restrict']['restrictextent']) ? $defaults['center']['restrict']['restrictextent'] : '');
     $form['center']['restrict']['restrictedExtent'] = array('#type' => 'textfield', '#title' => t('Restricted Extent'), '#description' => t('Prevents users from panning outside of a specific bounding box'), '#default_value' => isset($defaults['center']['restrict']['restrictedExtent']) ? $defaults['center']['restrict']['restrictedExtent'] : '', '#attributes' => array('class' => array('openlayers-form-restrictedExtent')), '#size' => 25, '#process' => array('ctools_dependent_process'), '#dependency' => array('restrictextent' => array(1)));
     // Layers & styles
     $form['layerstyles'] = array('#type' => 'fieldset', '#title' => t('Layers & Styles'), '#description' => t('Layer settings.  The Layer options will change based on the projection chosen.'), '#theme' => 'openlayers_ui_maps_form_layers', '#tree' => TRUE, '#group' => 'ui', '#prefix' => '', '#suffix' => '');
     // Projection options
     $projections = array();
     foreach (openlayers_ui_get_projection_options() as $projection) {
         $projection_layers = array_merge(openlayers_ui_get_layer_options('baselayer', $projection), openlayers_ui_get_layer_options('overlay', $projection));
         $projections[$projection->identifier] = theme('openlayers_ui_form_projection_description', array('projection' => $projection, 'available_layers' => $projection_layers));
     }
     $form['layerstyles']['projections'] = array('#type' => 'fieldset', '#title' => t('Projections'), '#description' => t('<p><strong>WARNING: Projections are not well supported in
   this module.  If you need to handle non spherical mercator projections
   you may be better using the API directly.</strong></p>
   <p>Select the !link_proj for your map.  The list next
   to each projection is the layers that support this projection.</p>', array('!link_proj' => l(t('geographical projection'), 'http://en.wikipedia.org/wiki/Map_projection'))), '#tree' => TRUE);
     $form['layerstyles']['projections']['easy_projection'] = array('#type' => 'radios', '#title' => t('Map Projection'), '#description' => t('The !link_proj of this map: all layers will either be requested or reprojected to this format.', array('!link_proj' => l(t('geographical projection'), 'http://en.wikipedia.org/wiki/Map_projection'))), '#default_value' => $defaults['projection']->identifier, '#options' => $projections, '#attributes' => array('class' => array('openlayers-form-easy-projection')), '#ajax' => array('callback' => 'openlayers_map_layerlist', 'wrapper' => 'edit-layerstyles', 'method' => 'replace', 'event' => 'change'));
     $displayProjectionOptions = array();
     foreach (openlayers_ui_get_projection_options() as $projectionIdentifier => $projection) {
         $displayProjectionOptions[$projectionIdentifier] = $projection->getLocalizedMessage();
     }
     $form['layerstyles']['projections']['displayProjection'] = array('#type' => 'select', '#title' => t('Display Projection'), '#description' => t('All interaction with the map - drawing, panning,
   centering, and more - occurs in the display projection. The vast majority
   of maps use 4326 (latitude/longitude) for this value.'), '#default_value' => !empty($defaults['displayProjection']) ? $defaults['displayProjection']->identifier : openlayers_get_projection('EPSG', '4326')->identifier, '#options' => $displayProjectionOptions);
     $form['layerstyles']['layers'] = array('#title' => t('Layers & Styles'), '#description' => t('Layer settings.  The Layer options will change based on the projection chosen.'), '#type' => 'fieldset');
     // Construct data for theme_openlayers_ui_maps_form_layers
     $form['layerstyles']['layers']['#tree'] = TRUE;
     $form['layerstyles']['layers']['baselabels'] = array();
     if (isset($form_state['values']['layerstyles']['projections']['easy_projection'])) {
         // Projection was choosen by editing the form
         $easy_projection = openlayers_get_projection_by_identifier($form_state['values']['layerstyles']['projections']['easy_projection']);
     } else {
         // Form was not yet edited, use default
         $easy_projection = $defaults['projection'];
     }
     $base_options = openlayers_ui_get_layer_options('baselayer', $easy_projection);
     foreach ($base_options as $id => $description) {
         $form['layerstyles']['layers']['baselabels'][$id] = array('#markup' => $description);
     }
     $form['layerstyles']['layers']['baselayers'] = array('#type' => 'checkboxes', '#options' => $base_options, '#default_value' => !empty($defaults['layers']) ? array_intersect_key($defaults['layers'], $base_options) : array());
     $form['layerstyles']['layers']['default_layer'] = array('#type' => 'radios', '#options' => $base_options, '#default_value' => !empty($defaults['default_layer']) && isset($base_options[$defaults['default_layer']]) ? $defaults['default_layer'] : NULL);
     // Overlay layers
     $overlay_options = openlayers_ui_get_layer_options('overlay', $easy_projection);
     $form['layerstyles']['layers']['overlaylabels'] = array();
     if (!empty($overlay_options)) {
         // Have enabled layers maintain their order
         $available = array_keys($overlay_options);
         $enabled = array_intersect(array_keys($defaults['layers']), $available);
         $disabled = array_diff($available, $enabled);
         $overlay_options_keys = array_merge($disabled, $enabled);
         // Create overlay options.
         $form['layerstyles']['layer_styles']['#tree'] = TRUE;
         $form['layerstyles']['layer_styles_select']['#tree'] = TRUE;
         $form['layerstyles']['layer_styles_temporary']['#tree'] = TRUE;
         $form['layerstyles']['layer_weight']['#tree'] = TRUE;
         foreach ($overlay_options_keys as $id) {
             $description = $overlay_options[$id];
             $form['layerstyles']['layers']['overlaylabels'][$id] = array('#markup' => $description);
             // Layer styles that define the default style of layer.
             $form['layerstyles']['layer_styles'][$id] = array('#type' => 'select', '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['layer_styles'][$id]) ? $defaults['layer_styles'][$id] : '');
             // Layer select style.
             $form['layerstyles']['layer_styles_select'][$id] = array('#type' => 'select', '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['layer_styles_select'][$id]) ? $defaults['layer_styles_select'][$id] : '');
             // Layer temporary style.
             $form['layerstyles']['layer_styles_temporary'][$id] = array('#type' => 'select', '#options' => array('<' . t('use default style') . '>') + openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['layer_styles_temporary'][$id]) ? $defaults['layer_styles_temporary'][$id] : '');
             // Weight of layer.  This will affect how the layer shows up in the
             // switcher and is rendered.
             $form['layerstyles']['layer_weight'][$id] = array('#type' => 'weight', '#default_value' => !empty($defaults['layer_weight'][$id]) ? $defaults['layer_weight'][$id] : 0, '#attributes' => array('class' => array('layer-weight')));
         }
         // Checkbox options for overlay layers.
         $form['layerstyles']['layers']['overlays'] = array('#type' => 'checkboxes', '#options' => $overlay_options, '#default_value' => !empty($defaults['layers']) ? array_intersect_key($defaults['layers'], $overlay_options) : array());
         $form['layerstyles']['layer_activated'] = array('#type' => 'checkboxes', '#options' => $overlay_options, '#default_value' => !empty($defaults['layer_activated']) ? array_intersect_key($defaults['layer_activated'], $overlay_options) : array());
         $form['layerstyles']['layer_switcher'] = array('#type' => 'checkboxes', '#options' => $overlay_options, '#default_value' => !empty($defaults['layer_switcher']) ? array_intersect_key($defaults['layer_switcher'], $overlay_options) : array());
     }
     // Data overlay help.
     $form['layerstyles']['help_data_overlays'] = array('#type' => 'item', '#description' => t('<strong>Add Data Overlays</strong>: You can add regular
   overlays, like <a href="!geojson">GeoJSON</a> or <a href="!kml">KML</a>,
   or you can utilize <a href="!views_url">Views</a> to create data overlays.
   To create a Views-based overlay, you must choose the <strong>OpenLayers
   Data Overlay Display Type</strong>, and then explicitly set the the
   <strong>same for the Format</strong>.  The options in the <em>Format
   Settings</em> will only use fields you have added. To learn more, take
   a look at the <a href="!online_url">online documentation on Drupal.org</a>.', array('!views_url' => url('admin/structure/views'), '!geojson' => url('admin/structure/openlayers/layers/add/openlayers_layer_type_geojson'), '!kml' => url('admin/structure/openlayers/layers/add/openlayers_layer_type_kml'), '!online_url' => url('http://drupal.org/node/595872'))));
     // Styles
     $form['layerstyles']['styles'] = array('#type' => 'fieldset', '#title' => t('Default Styles'), '#description' => t('Define default style designations for layers when there
   are no overrides.'), '#tree' => TRUE);
     $form['layerstyles']['styles']['default'] = array('#type' => 'select', '#title' => t('Default style'), '#description' => t('Default style for features in a vector.'), '#options' => openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['styles']['default']) ? $defaults['styles']['default'] : NULL);
     $form['layerstyles']['styles']['select'] = array('#type' => 'select', '#title' => t('Select style'), '#description' => t('Style for features in a vector that are selected.'), '#options' => openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['styles']['select']) ? $defaults['styles']['select'] : NULL);
     $form['layerstyles']['styles']['temporary'] = array('#type' => 'select', '#title' => t('Temporary Style'), '#description' => t('Default temporary style for any features in a vector.
   This can be used with the "Hover behavior" or things like Tooltips.'), '#options' => openlayers_ui_get_style_options(), '#default_value' => !empty($defaults['styles']['temporary']) ? $defaults['styles']['temporary'] : NULL);
     // Behaviors
     $form['behaviors'] = array('#title' => t('Behaviors'), '#description' => t('Configure interactive map behaviors.  Behaviors are general interactions for the map, they can be anything from popups or keyboard handling.  Enable the ones you want and their respective options.  Note that some behaviors do not work with each other or one may encompass another.'), '#theme' => 'openlayers_ui_maps_form_behaviors', '#tree' => TRUE, '#type' => 'fieldset', '#group' => 'ui');
     $form['behaviors'] = $form['behaviors'] + openlayers_ui_get_behavior_options('map', $defaults);
     // Displays
     $form['displays'] = array('#title' => t('Displays'), '#description' => t('Learn how to display your maps.'), '#tree' => TRUE, '#type' => 'fieldset', '#group' => 'ui');
     if (module_exists('openlayers_views')) {
         $form['displays']['views'] = array('#type' => 'item', '#title' => t('Views'), '#description' => t('Utilize the <a href="!views_url">Views</a> module to
     display your map as page or in a block.  By creating a new Views Display of
     type <strong>Page</strong> or <strong>Block</strong> you can then choose
     the <strong>OpenLayers Map Format</strong>.  For more details, check out
     the <a href="!online_url">online documentation on Drupal.org</a>.', array('!views_url' => url('admin/structure/views'), '!online_url' => url('http://drupal.org/node/595872'))), '#suffix' => theme('image', array('path' => 'https://img.skitch.com/20111106-c6ukwxgpgykxx8m41yrn8qew4n.png')));
         $form['displays']['api'] = array('#type' => 'item', '#title' => t('API'), '#description' => t('You can always utilize the API to directly display
     your maps.  The key function to use is <code>openlayers_render_map()</code>.
     Most of the code is well documented.  To learn how to extend the module,
     take a look at the <a href="!online_url">online documentation on
     Drupal.org</a> as well as the files in the <code>docs/</code> folder.', array('!online_url' => url('http://drupal.org/node/595872'))));
     }
     $form['buttons']['submit']['#weight'] = 0;
     $form['buttons']['delete']['#weight'] = 20;
     $form['buttons']['saveandedit'] = array('#type' => 'submit', '#value' => t('Save and edit'), '#weight' => 10);
     // Add preview button.
     $form['buttons']['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 30);
 }
 /**
  * Implements edit_form().
  */
 function edit_form(&$form, &$form_state)
 {
     if ($form_state['form type'] == 'add') {
         //parent::edit_form($form, $form_state);
         $this->_add_form($form, $form_state);
     } else {
         parent::edit_form($form, $form_state);
         $this->_edit_form($form, $form_state);
     }
 }
 function edit_form(&$form, &$form_state)
 {
     ctools_include('plugins', 'panels');
     // If the plugin is not set, then it should be provided as an argument:
     if (!isset($form_state['item']->plugin)) {
         $form_state['item']->plugin = $form_state['function args'][2];
     }
     parent::edit_form($form, $form_state);
     $form['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#description' => t('What category this layout should appear in. If left blank the category will be "Miscellaneous".'), '#default_value' => $form_state['item']->category);
     ctools_include('context');
     ctools_include('display-edit', 'panels');
     ctools_include('content');
     // Provide actual layout admin UI here.
     // Create a display for editing:
     $cache_key = 'builder-' . $form_state['item']->name;
     // Load the display being edited from cache, if possible.
     if (!empty($_POST) && is_object($cache = panels_edit_cache_get($cache_key))) {
         $display =& $cache->display;
     } else {
         $content_types = ctools_content_get_available_types();
         panels_cache_clear('display', $cache_key);
         $cache = new stdClass();
         $display = panels_new_display();
         $display->did = $form_state['item']->name;
         $display->layout = $form_state['item']->plugin;
         $display->layout_settings = $form_state['item']->settings;
         $display->cache_key = $cache_key;
         $display->editing_layout = TRUE;
         $cache->display = $display;
         $cache->content_types = $content_types;
         $cache->display_title = FALSE;
         panels_edit_cache_set($cache);
     }
     // Set up lipsum content in all of the existing panel regions:
     $display->content = array();
     $display->panels = array();
     $custom = ctools_get_content_type('custom');
     $layout = panels_get_layout($display->layout);
     $regions = panels_get_regions($layout, $display);
     foreach ($regions as $id => $title) {
         $pane = panels_new_pane('custom', 'custom');
         $pane->pid = $id;
         $pane->panel = $id;
         $pane->configuration = ctools_content_get_defaults($custom, 'custom');
         $pane->configuration['title'] = 'Lorem Ipsum';
         $pane->configuration['body'] = $this->lipsum;
         $display->content[$id] = $pane;
         $display->panels[$id] = array($id);
     }
     $form_state['display'] =& $display;
     // Tell the Panels form not to display buttons.
     $form_state['no buttons'] = TRUE;
     $form_state['no display settings'] = TRUE;
     $form_state['cache_key'] = $cache_key;
     $form_state['content_types'] = $cache->content_types;
     $form_state['display_title'] = FALSE;
     $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
     $form_state['renderer']->cache =& $cache;
     $form = panels_edit_display_form($form, $form_state);
     // If we leave the standard submit handler, it'll try to reconcile
     // content from the input, but we've not exposed that to the user. This
     // makes previews work with the content we forced in.
     $form['preview']['button']['#submit'] = array('panels_edit_display_form_preview');
 }
Beispiel #28
0
 /**
  * Overrides the actual editing form.
  */
 public function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     ctools_form_include($form_state, 'slick.admin', 'slick');
     $module_path = drupal_get_path('module', 'slick');
     $optionset = $form_state['item'];
     $options = $optionset->options;
     $slick_options = slick_get_options();
     $form['#attached']['library'][] = array('slick_ui', 'slick.ui');
     $form['#attached']['css'][] = $module_path . '/css/admin/slick.admin--vertical-tabs.css';
     $form['#attributes']['class'][] = 'no-js';
     $form['#attributes']['class'][] = 'form--slick';
     $form['#attributes']['class'][] = 'form--compact';
     $form['#attributes']['class'][] = 'form--optionset';
     $form['#attributes']['class'][] = 'clearfix';
     $form['info']['name']['#attributes']['class'][] = 'is-tooltip';
     $form['info']['label']['#attributes']['class'][] = 'is-tooltip';
     $form['info']['label']['#prefix'] = '<div class="form--slick__header has-tooltip clearfix">';
     // Skins. We don't provide skin_thumbnail as each optionset may be deployed
     // as main display, or thumbnail navigation.
     $skins = slick_skins_options();
     $form['skin'] = array('#type' => 'select', '#title' => t('Skin'), '#options' => $skins, '#default_value' => $optionset->skin, '#empty_option' => t('- None -'), '#description' => t('Skins allow swappable layouts like next/prev links, split image and caption, etc. Be sure to provide a dedicated slide layout per field. However a combination of skins and options may lead to unpredictable layouts, get dirty yourself. See main <a href="@skin">README</a> for details on Skins. Keep it simple for thumbnail navigation skin.', array('@skin' => url($module_path . '/README.txt'))), '#attributes' => array('class' => array('is-tooltip')));
     $form['breakpoints'] = array('#title' => t('Breakpoints'), '#type' => 'textfield', '#description' => t('The number of breakpoints added to Responsive display, max 9. This is not Breakpoint Width (480px, etc).'), '#default_value' => isset($form_state['values']['breakpoints']) ? $form_state['values']['breakpoints'] : $optionset->breakpoints, '#suffix' => '</div>', '#ajax' => array('callback' => 'slick_ui_add_breakpoints', 'wrapper' => 'breakpoints-ajax-wrapper', 'event' => 'blur'), '#attributes' => array('class' => array('is-tooltip')), '#maxlength' => 1);
     // Options.
     $form['options'] = array('#type' => 'vertical_tabs', '#tree' => TRUE);
     // Image styles.
     $image_styles = function_exists('image_style_options') ? image_style_options(FALSE) : array();
     $form['options']['general'] = array('#type' => 'fieldset', '#title' => t('General'), '#attributes' => array('class' => array('has-tooltip', 'fieldset--no-checkboxes-label')));
     $form['options']['general']['normal'] = array('#type' => 'select', '#title' => t('Image style'), '#description' => t('Image style for the main/background image, overriden by field formatter. Useful for custom work.'), '#empty_option' => t('None (original image)'), '#options' => $image_styles, '#default_value' => isset($options['general']['normal']) ? $options['general']['normal'] : '', '#attributes' => array('class' => array('is-tooltip')));
     // More useful for custom work, overriden by sub-modules.
     $form['options']['general']['thumbnail'] = array('#type' => 'select', '#title' => t('Thumbnail style'), '#description' => t('Image style for the thumbnail image if using asNavFor, overriden by field formatter. Useful for custom work.'), '#empty_option' => t('None (original image)'), '#options' => $image_styles, '#default_value' => isset($options['general']['thumbnail']) ? $options['general']['thumbnail'] : '', '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['template_class'] = array('#type' => 'textfield', '#title' => t('Wrapper class'), '#description' => t('Additional template wrapper classes separated by spaces. No need to prefix it with a dot (.).'), '#default_value' => isset($options['general']['template_class']) ? $options['general']['template_class'] : '', '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['goodies'] = array('#type' => 'checkboxes', '#title' => t('Goodies'), '#default_value' => !empty($options['general']['goodies']) ? array_values((array) $options['general']['goodies']) : array(), '#options' => array('pattern' => t('Use pattern overlay'), 'arrow-down' => t('Use arrow down'), 'random' => t('Randomize')), '#description' => t('Applies to main display, not thumbnail pager. <ol><li>Pattern overlay is background image with pattern placed over the main stage.</li><li>Arrow down to scroll down into a certain page section, make sure to provide target selector.</li><li>Randomize the slide display, useful to manipulate cached blocks.</li></ol>'), '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['arrow_down_target'] = array('#type' => 'textfield', '#title' => t('Arrow down target'), '#description' => t('Valid CSS selector to scroll to, e.g.: #main, or #content.'), '#default_value' => isset($options['general']['arrow_down_target']) ? $options['general']['arrow_down_target'] : '', '#states' => array('visible' => array(':input[name*=arrow-down]' => array('checked' => TRUE))), '#attributes' => array('class' => array('is-tooltip')));
     $form['options']['general']['arrow_down_offset'] = array('#type' => 'textfield', '#title' => t('Arrow down offset'), '#description' => t('Offset when scrolled down from the top.'), '#default_value' => isset($options['general']['arrow_down_offset']) ? $options['general']['arrow_down_offset'] : '', '#states' => array('visible' => array(':input[name*=arrow-down]' => array('checked' => TRUE))), '#attributes' => array('class' => array('is-tooltip')));
     // Add empty suffix to style checkboxes like iOS.
     foreach ($form['options']['general']['goodies']['#options'] as $key => $value) {
         $form['options']['general']['goodies'][$key]['#field_suffix'] = '';
         $form['options']['general']['goodies'][$key]['#title_display'] = 'before';
     }
     // Main options.
     $slick_elements = $this->getSlickElements();
     $form['options']['settings'] = array('#title' => t('Settings'), '#type' => 'fieldset', '#collapsible' => FALSE, '#tree' => TRUE, '#attributes' => array('class' => array('fieldset--settings', 'has-tooltip')));
     foreach ($slick_elements as $name => $element) {
         $default_value = isset($options['settings'][$name]) ? $options['settings'][$name] : $element['default'];
         // Allows to reset string values by emptying it, such as changing arrows.
         if (is_string($default_value) && empty($default_value)) {
             $default_value = $element['default'];
         }
         $form['options']['settings'][$name] = array('#title' => isset($element['title']) ? $element['title'] : '', '#description' => isset($element['description']) ? $element['description'] : '', '#type' => $element['type'], '#default_value' => $default_value, '#attributes' => array('class' => array('is-tooltip')));
         if (isset($element['field_suffix'])) {
             $form['options']['settings'][$name]['#field_suffix'] = $element['field_suffix'];
         }
         if ($element['type'] == 'textfield') {
             $form['options']['settings'][$name]['#size'] = 20;
             $form['options']['settings'][$name]['#maxlength'] = 255;
         }
         if (!isset($element['field_suffix']) && is_bool($element['default'])) {
             $form['options']['settings'][$name]['#field_suffix'] = '';
             $form['options']['settings'][$name]['#title_display'] = 'before';
         }
         if (is_int($element['default'])) {
             $form['options']['settings'][$name]['#maxlength'] = 60;
             $form['options']['settings'][$name]['#attributes']['class'][] = 'form-text--int';
         }
         if (isset($element['states'])) {
             $form['options']['settings'][$name]['#states'] = $element['states'];
         }
         if (isset($element['options'])) {
             $form['options']['settings'][$name]['#options'] = $element['options'];
         }
         if (isset($element['empty_option'])) {
             $form['options']['settings'][$name]['#empty_option'] = $element['empty_option'];
         }
         // Expand textfield for easy edit.
         if (in_array($name, array('prevArrow', 'nextArrow'))) {
             $form['options']['settings'][$name]['#attributes']['class'][] = 'js-expandable';
         }
     }
     // Responsive options.
     $form['options']['responsives'] = array('#title' => t('Responsive display'), '#type' => 'fieldset', '#description' => t('Containing breakpoints and settings objects. Settings set at a given breakpoint/screen width is self-contained and does not inherit the main settings, but defaults.'), '#collapsible' => FALSE, '#tree' => TRUE);
     $form['options']['responsives']['responsive'] = array('#title' => t('Responsive'), '#type' => 'fieldset', '#collapsible' => FALSE, '#attributes' => array('class' => array('has-tooltip', 'fieldset--responsive--ajax')), '#prefix' => '<div id="breakpoints-ajax-wrapper">', '#suffix' => '</div>');
     $breakpoints_count = isset($form_state['values']['breakpoints']) ? $form_state['values']['breakpoints'] : $optionset->breakpoints;
     $form_state['breakpoints_count'] = $breakpoints_count;
     if ($form_state['breakpoints_count'] > 0) {
         $slick_responsive_elements = $this->getSlickResponsiveElements($form_state['breakpoints_count']);
         foreach ($slick_responsive_elements as $i => $responsives) {
             // Individual breakpoint fieldset.
             $fieldset_class = drupal_clean_css_identifier(drupal_strtolower($responsives['title']));
             $form['options']['responsives']['responsive'][$i] = array('#title' => $responsives['title'], '#type' => $responsives['type'], '#description' => isset($responsives['description']) ? $responsives['description'] : '', '#collapsible' => TRUE, '#collapsed' => TRUE, '#attributes' => array('class' => array('fieldset--responsive', 'fieldset--' . $fieldset_class, 'has-tooltip')));
             foreach ($responsives as $key => $responsive) {
                 switch ($key) {
                     case 'breakpoint':
                     case 'unslick':
                         $form['options']['responsives']['responsive'][$i][$key] = array('#title' => $responsive['title'], '#description' => $responsive['description'], '#type' => $responsive['type'], '#default_value' => isset($options['responsives']['responsive'][$i][$key]) ? $options['responsives']['responsive'][$i][$key] : $responsive['default'], '#attributes' => array('class' => array('is-tooltip')));
                         if ($responsive['type'] == 'textfield') {
                             $form['options']['responsives']['responsive'][$i][$key]['#size'] = 20;
                             $form['options']['responsives']['responsive'][$i][$key]['#maxlength'] = 255;
                         }
                         if (is_int($responsive['default'])) {
                             $form['options']['responsives']['responsive'][$i][$key]['#maxlength'] = 60;
                         }
                         if (isset($responsive['states'])) {
                             $form['options']['responsives']['responsive'][$i][$key]['#states'] = $responsive['states'];
                         }
                         if (isset($responsive['options'])) {
                             $form['options']['responsives']['responsive'][$i][$key]['#options'] = $responsive['options'];
                         }
                         if (isset($responsive['field_suffix'])) {
                             $form['options']['responsives']['responsive'][$i][$key]['#field_suffix'] = $responsive['field_suffix'];
                         }
                         if (!isset($responsive['field_suffix']) && is_bool($responsive['default'])) {
                             $form['options']['responsives']['responsive'][$i][$key]['#field_suffix'] = '';
                             $form['options']['responsives']['responsive'][$i][$key]['#title_display'] = 'before';
                         }
                         break;
                     case 'settings':
                         $form['options']['responsives']['responsive'][$i][$key] = array('#title' => t('Settings'), '#title_display' => 'invisible', '#type' => 'fieldset', '#collapsible' => FALSE, '#collapsed' => FALSE, '#attributes' => array('class' => array('fieldset--settings', 'fieldset--' . $fieldset_class, 'has-tooltip')), '#states' => array('visible' => array(':input[name*="[responsive][' . $i . '][unslick]"]' => array('checked' => FALSE))));
                         unset($responsive['title'], $responsive['type']);
                         if (!is_array($responsive)) {
                             continue;
                         }
                         foreach ($responsive as $k => $item) {
                             if ($item && !is_array($item)) {
                                 continue;
                             }
                             $form['options']['responsives']['responsive'][$i][$key][$k] = array('#title' => isset($item['title']) ? $item['title'] : '', '#description' => isset($item['description']) ? $item['description'] : '', '#type' => $item['type'], '#attributes' => array('class' => array('is-tooltip')), '#default_value' => isset($options['responsives']['responsive'][$i][$key][$k]) ? $options['responsives']['responsive'][$i][$key][$k] : $item['default']);
                             // Specify proper states for the breakpoint elements.
                             if (isset($item['states'])) {
                                 $states = '';
                                 switch ($k) {
                                     case 'pauseOnHover':
                                     case 'pauseOnDotsHover':
                                     case 'autoplaySpeed':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][autoplay]"]' => array('checked' => TRUE)));
                                         break;
                                     case 'centerPadding':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][centerMode]"]' => array('checked' => TRUE)));
                                         break;
                                     case 'touchThreshold':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][touchMove]"]' => array('checked' => TRUE)));
                                         break;
                                     case 'swipeToSlide':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][swipe]"]' => array('checked' => TRUE)));
                                         break;
                                     case 'cssEase':
                                     case 'cssEaseOverride':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][useCSS]"]' => array('checked' => TRUE)));
                                         break;
                                     case 'verticalSwiping':
                                         $states = array('visible' => array(':input[name*="[' . $i . '][settings][vertical]"]' => array('checked' => TRUE)));
                                         break;
                                 }
                                 if ($states) {
                                     $form['options']['responsives']['responsive'][$i][$key][$k]['#states'] = $states;
                                 }
                             }
                             if (isset($item['options'])) {
                                 $form['options']['responsives']['responsive'][$i][$key][$k]['#options'] = $item['options'];
                             }
                             if (isset($item['empty_option'])) {
                                 $form['options']['responsives']['responsive'][$i][$key][$k]['#empty_option'] = $item['empty_option'];
                             }
                             if (isset($item['field_suffix'])) {
                                 $form['options']['responsives']['responsive'][$i][$key][$k]['#field_suffix'] = $item['field_suffix'];
                             }
                             if (!isset($item['field_suffix']) && is_bool($item['default'])) {
                                 $form['options']['responsives']['responsive'][$i][$key][$k]['#field_suffix'] = '';
                                 $form['options']['responsives']['responsive'][$i][$key][$k]['#title_display'] = 'before';
                             }
                         }
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     // Allows form elements information to be altered without a class.
     // @see ctools_export_ui_edit_item_form
     drupal_alter('slick_ui_optionset_form', $form, $form_state);
 }
 /**
  * Provide the actual editing form.
  */
 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $settings = $form_state['item']->settings;
     $new = TRUE;
     $form['label'] = array('#type' => 'textfield', '#title' => t('Label'), '#default_value' => isset($form_state['item']->label) ? $form_state['item']->label : array(), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#attributes' => $new ? array() : array('readonly' => 'readonly'));
     $form['module'] = array('#type' => 'textfield', '#title' => t('Module'), '#default_value' => isset($form_state['item']->module) ? $form_state['item']->module : array(), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, '#attributes' => $new ? array() : array('readonly' => 'readonly'));
     $form['settings'] = array('#type' => 'fieldset', '#title' => t('Settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE, '#group' => 'general-tab');
     $plugin_name = $form_state['item']->plugin_name;
     $pluginWrapper = heartbeat_plugins_get_plugin($plugin_name);
     if ($pluginWrapper instanceof iHeartbeatPluginWrapper) {
         $plugin = $pluginWrapper->getPlugin();
         if ($plugin) {
             $plugin->pluginUIForm($form, $form_state);
         }
         $new = FALSE;
     }
     if ($new) {
         $form['settings']['attachment'] = array('#type' => 'checkbox', '#title' => t('Attachment'), '#default_value' => isset($settings['attachment']) ? $settings['attachment'] : array());
     }
     if (!element_children($form['settings'])) {
         unset($form['settings']);
     }
     // Clear the cache for heartbeat plugins.
     cache_clear_all('heartbeat_plugins', 'cache');
 }