/**
  * Overrides ctools_export_ui::edit_save_form().
  *
  * Clear menu cache in case the SPARQL endpoint path was modified.
  */
 function edit_save_form($form_state)
 {
     parent::edit_save_form($form_state);
     if (!empty($form_state['plugin']['schema']) && $form_state['plugin']['schema'] == 'arc2_store_settings') {
         menu_rebuild();
     }
 }
 function list_filter($form_state, $item)
 {
     if ($form_state['values']['category'] != 'all' && $form_state['values']['category'] != $item->category) {
         return TRUE;
     }
     return parent::list_filter($form_state, $item);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
 function hook_menu(&$items)
 {
     // Change the item to a tab on the fb_social configuration page.
     $this->plugin['menu']['items']['list callback']['type'] = MENU_LOCAL_TASK;
     $this->plugin['menu']['items']['list callback']['weight'] = 10;
     parent::hook_menu($items);
 }
 /**
  * Create the filter/sort form at the top of a list of exports.
  */
 function list_form(&$form, &$form_state)
 {
     // Put a wrapper around the form so it can be hidden.  Unsetting the form
     // rows or doing nothing here doesn't seem to do the trick.
     parent::list_form($form, $form_state);
     $form['#prefix'] = '<div class="finder-ui-list-wrapper">' . $form['#prefix'];
     $form['#suffix'] = $form['#prefix'] . '</div>';
 }
 /**
  * Overrides ctools_export_ui::list_form().
  *
  * Simplifies the form similar to how the Context module does it.
  */
 function list_form(&$form, &$form_state)
 {
     parent::list_form($form, $form_state);
     $form['top row']['submit'] = $form['bottom row']['submit'];
     $form['top row']['reset'] = $form['bottom row']['reset'];
     $form['bottom row']['#access'] = FALSE;
     return;
 }
 /**
  * Remove fields associated to bundles that are being deleted.
  */
 function delete_form_submit(&$form_state)
 {
     parent::delete_form_submit($form_state);
     if ($form_state['op'] == 'delete') {
         field_attach_delete_bundle('fieldable_panels_pane', $form_state['item']->name);
         entity_info_cache_clear();
     }
 }
Exemplo n.º 9
0
 function edit_form_submit(&$form, &$form_state)
 {
     $form_state["values"]['changed'] = time();
     parent::edit_form_submit($form, $form_state);
     $template_code = $form_state["values"]['html'];
     $item = $form_state['item'];
     zm_template_save_template($template_code, $item->name);
 }
Exemplo n.º 10
0
 /**
  * Prepare the tag values before they are added to the database.
  */
 function edit_form_submit(&$form, &$form_state)
 {
     $settings = $form_state['values']['settings'];
     // Since the targeting form is reusable it isn't already in the settings
     // array so we grab it here.
     $settings['targeting'] = $form_state['values']['targeting'];
     $form_state['values']['settings'] = serialize($settings);
     parent::edit_form_submit($form, $form_state);
 }
 function edit_form_submit(&$form, &$form_state)
 {
     parent::edit_form_submit($form, $form_state);
     if (module_exists('mailhandler_default')) {
         drupal_set_message(t("Now that you've created a mailbox, send it a test email and try to <a href='@import-page'>create a source node</a> to start importing messages.", array('@import-page' => url('node/add/mailhandler-source'))));
     } else {
         drupal_set_message(t("Now that you've created a mailbox, you'll need to <a href='@importer-add'>create a Feeds importer</a> or <a href='@import-page'>run an existing importer</a>. Consider <a href='@module-page'>enabling the Mailhandler quick-start</a> module.", array('@importer-add' => url(MAILHANDLER_MENU_PREFIX . '/feeds/add'), '@import-page' => url('import'), '@module-page' => url('admin/modules'))));
     }
 }
Exemplo n.º 12
0
 function list_form(&$form, &$form_state)
 {
     parent::list_form($form, $form_state);
     $form['top row']['submit'] = $form['bottom row']['submit'];
     $form['top row']['reset'] = $form['bottom row']['reset'];
     $form['bottom row']['#access'] = FALSE;
     // Invalidate the context cache.
     context_invalidate_cache();
     return;
 }
 function edit_form_submit($form, &$form_state) {
   parent::edit_form_submit($form, $form_state);
   $type = substr($form_state['values']['service_charge'], -1) == '%' ? 'percentage' : 'price';
   $amount = str_replace(array('%', '='), '', $form_state['values']['service_charge']);
   $form_state['item']->data = array(
     'service_charge' => trim($amount),
     'service_charge_type' => $type,
     'service_charge_title' => $form_state['values']['service_charge_title'],
   );
 }
Exemplo n.º 14
0
  /**
   * Provide a list of sort options.
   */
  function list_sort_options() {
    $options = parent::list_sort_options();

    $options += array(
      'width' => t('Width'),
      'height' => t('Height'),
    );

    return $options;
  }
 /**
  * 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';
 }
Exemplo n.º 16
0
 /**
  * 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;
         }
     }
 }
Exemplo n.º 17
0
 function list_form(&$form, &$form_state)
 {
     parent::list_form($form, $form_state);
     // This is perhaps a bit brutal, but I don't think that any sites
     // will have enough premium levels to warrant the very fancy
     // filtering interface CTools provide by default. If you really need
     // this interface, please file a bug, and we will consider making an
     // option for enabling it.
     // TODO: This is really an ugly way to hide these, but pending
     // resolution of http://drupal.org/node/1133740, it seems to be the
     // best way to go.
     $form['top row']['#access'] = FALSE;
     $form['bottom row']['#access'] = FALSE;
 }
 /**
  * {@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>';
 }
 /**
  * Validate callback for the edit form.
  */
 function edit_form_validate(&$form, &$form_state)
 {
     parent::edit_form_validate($form, $form_state);
     $pluginName = $form_state['values']['plugin_name'];
     if (empty($pluginName)) {
         form_set_error('plugin_name', t('No valid plugin name given. The plugin needs to be a valid class as extension of iHeartbeatPlugin.'));
     }
     $pluginWrapper = heartbeat_plugins_get_plugin($pluginName);
     if ($pluginWrapper instanceof iHeartbeatPluginWrapper) {
         $plugin = $pluginWrapper->getPlugin();
     }
     if (!$plugin instanceof HeartbeatBasePlugin) {
         form_set_error('plugin_name', t('Class @class does not implement HeartbeatBasePlugin.', array('@class' => $pluginName)));
     }
 }
 function edit_execute_form_standard(&$form_state)
 {
     if ($form_state['form type'] == 'clone') {
         list($x, $y, $name) = explode(':', $form_state['original name']);
         $form_state['item']->title = t('Clone of') . ' ' . $form_state['item']->title;
         $form_state['item']->name = 'clone_of_' . $name;
     } else {
         if ($form_state['op'] == 'add') {
             $form_state['item']->panelizer_type = $this->entity_handler->entity_type;
             $form_state['item']->panelizer_key = $this->entity_bundle;
             $form_state['item']->view_mode = $this->entity_view_mode;
             $form_state['item']->display = $this->entity_handler->get_default_display();
         }
     }
     return parent::edit_execute_form_standard($form_state);
 }
 /**
  * Overrides ctools_export_ui::edit_execute_form().
  *
  * This is hacky, but since CTools Export UI uses drupal_goto() we have to
  * effectively change the plugin to modify the redirect path dynamically.
  */
 function edit_execute_form(&$form_state)
 {
     $output = parent::edit_execute_form($form_state);
     if (!empty($form_state['executed'])) {
         $clicked = $form_state['clicked_button']['#value'];
         if (t('Add item') == $clicked || t('Save and edit') == $clicked) {
             // We always want to redirect back to this page when adding an item,
             // but we want to preserve the destination so we can be redirected back
             // to where we came from after clicking "Save".
             $options = array();
             if (!empty($_GET['destination'])) {
                 $options['query']['destination'] = $_GET['destination'];
                 unset($_GET['destination']);
             }
             // Sets redirect path and options.
             $op = $form_state['op'];
             $name = $form_state['values']['name'];
             $path = 'add' != $op ? current_path() : 'admin/config/search/current_search/list/' . $name . '/edit';
             $this->plugin['redirect'][$op] = array($path, $options);
         }
     }
     return $output;
 }
 function edit_form_submit(&$form, &$form_state) {
   parent::edit_form_submit($form, $form_state);
   $form_state['item']->category = $form_state['values']['category'];
 }
 /**
  * Implements edit_form_submit().
  */
 function edit_form_submit(&$form, &$form_state)
 {
     if (isset($form_state['values']['stream_op']) && $form_state['values']['stream_op'] == 'add_clone') {
         $pluginBasePath = ctools_export_ui_plugin_base_path($this->plugin) . '/list/';
         drupal_goto($pluginBasePath . $form_state['values']['stream_original'] . '/clone');
     } else {
         // First change the values.
         foreach ($form_state['values']['settings'] as $name => $setting) {
             if (is_array($setting)) {
                 foreach ($setting as $key => $value) {
                     $form_state['values']['settings'][$key] = $value;
                 }
                 unset($form_state['values']['settings'][$name]);
             }
         }
         heartbeat_stream_config_reset();
         // Let CTools prepare the "item" variable as normal.
         parent::edit_form_submit($form, $form_state);
         drupal_set_message(t('Heartbeat streams cache has been cleared and menu is rebuild.'));
     }
 }
 function edit_execute_form_standard(&$form_state)
 {
     if ($form_state['form type'] == 'clone') {
         $form_state['item']->title = t('Clone of') . ' ' . $form_state['item']->title;
         $form_state['item']->name = '';
     } else {
         if ($form_state['op'] == 'add') {
             $form_state['item']->panelizer_type = $this->entity_handler->entity_type;
             $form_state['item']->panelizer_key = $this->entity_bundle;
             $form_state['item']->view_mode = $this->entity_view_mode;
             $form_state['item']->display = $this->entity_handler->get_default_display($this->entity_bundle, $this->entity_view_mode);
         }
     }
     return parent::edit_execute_form_standard($form_state);
 }
Exemplo n.º 25
0
 function list_page($js, $input)
 {
     // wrap output in a div for CSS
     $output = parent::list_page($js, $input);
     if (is_string($output)) {
         $output = '<div id="views-ui-list-page">' . $output . '</div>';
         return $output;
     }
 }
Exemplo n.º 26
0
 function edit_wizard_finish(&$form_state)
 {
     // These might be stored by the stylizer wizard, so we should clear them.
     if (isset($form_state['settings']['old_settings'])) {
         unset($form_state['settings']['old_settings']);
     }
     $this->store_stylizer_info($form_state);
     parent::edit_wizard_finish($form_state);
 }
 /**
  * hook_menu() entry point.
  *
  * Child implementations that need to add or modify menu items should
  * probably call parent::hook_menu($items) and then modify as needed.
  */
 function hook_menu(&$items)
 {
     parent::hook_menu($items);
     $items['admin/structure/openlayers/layers']['type'] = MENU_LOCAL_TASK;
 }
Exemplo n.º 28
0
 /**
  * Implementats CTools psuedo hook_menu_alter().
  *
  * @todo
  *   Can we do this in $plugin instead?
  */
 function hook_menu(&$items)
 {
     parent::hook_menu($items);
     $items['admin/structure/deploy/plans']['type'] = MENU_LOCAL_TASK;
     $items['admin/structure/deploy/plans']['weight'] = -10;
 }
 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';
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 30
0
  function list_filter($form_state, $view) {
    if ($form_state['values']['base'] != 'all' && $form_state['values']['base'] != $view->base_table) {
      return TRUE;
    }

    return parent::list_filter($form_state, $view);
  }