Git Product home page Git Product logo

ctools_automodal's People

Contributors

acouch avatar davereid avatar greggles avatar wojtha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ctools_automodal's Issues

preg_match() expects parameter 2 to be string, array given ctools_automodal.module line 203

It seems that this function https://github.com/wojtha/ctools_automodal/blob/master/ctools_automodal.module#L82

Can return either a string if the item gets imploded or an array, if it doesn't. I suggest:

  if (in_array(end($path_parts), array('nojs', 'ajax'))) {
    array_pop($path_parts);
    $path = implode('/', $path_parts);
  }
  else {
    $path = implode('/', $path_parts);
  }

or even:

  if (in_array(end($path_parts), array('nojs', 'ajax'))) {
    array_pop($path_parts);
  }
  $path = implode('/', $path_parts);

PHP 5.3 code breaks older versions

$convert_to_regexp = function ($value) { return preg_replace('/%[^\/]*/', '[^/]+', $value); };

These inline functions will break on php < 5.3

compatible with node_add / {node-type}_node_form?

I would like to use the module with {node-type}_node_form or a node_add form.
I've tried to use a custom drupal_get_form function which prints the node_add form. The form gets rendered and the submissions works but with incorrect validation errors and if i left required fields empty the validation is skipped.

What am i making wrong?

My code is the following:

function cst_ctools_forms_menu(){
  $items['show-form/optin'] = array(
    'title' => t('Nur noch wenige Schritte'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('cst_ctools_forms_modal_form'),
     'access callback' => 'node_access',
     'access arguments' => array('create', 'optin'),
    'type' => MENU_CALLBACK,
  );
}

function cst_ctools_forms_modal_form($form, &$form_state){
  global $user;
  $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => 'opt_in', 'language' => LANGUAGE_NONE);
  $form_state['build_info']['args'] = array($node);
  form_load_include($form_state, 'inc', 'node', 'node.pages');
  return drupal_build_form('opt_in_node_form', $form_state);
}

function cst_ctools_forms_modal_paths() {
  $paths = array();

  $paths['show-form/optin'] = array(
    'style' => 'example-optin',
    'redirect' => 'confirmation/optin',
    'close' => TRUE,
  );

  return $paths;
}

/**
 * Implements hook_modal_styles().
 */
function cst_ctools_forms_modal_styles() {
  $styles = array();

  $styles['example-optin'] = array(
    'modalSize' => array(
      'type' => 'fixed',
      'width' => 500,
      'height' => 500,
    ),
  );
  return $styles;
}

I've also tried it with a menu_alter like this

function cst_ctools_forms_menu_alter(&$items) {
  $items['show-form/optin'] = $items['node/add/optin'];
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.