It would be great to have ctools context plugin for add (and edit) eck form.
Or maybe there is another way to get this functionality?

Thank you for very usefull module!

Comments

mnico’s picture

Assigned: Unassigned » mnico

Yes, I will try to add this feature ;)

mnico’s picture

Status: Active » Needs work

  • mnico committed 3389bf1 on 7.x-1.x
    Issue #2369217 by mnico: Added the feature to override the add/edit form...
mnico’s picture

Status: Needs work » Needs review

Functionality has been added to the development branch. Please review it and test it. ;)
Maybe it has some minor bugs.

rozh’s picture

Status: Needs review » Reviewed & tested by the community

Wow! That was speed of light :) And it works great.

Is it possible to create context plugin like it was done in https://www.drupal.org/project/entityform_panels? With this plugin you have to add context to page then select fields in the "Add content" dialog, so you can insert add form in any page. With eck_pm we have add form only on /admin/structure/entity-type/some-entity/some-bundle/add which is not very beautiful path.

Or maybe there is a way to change path for entity add page. If so could you point me how to do that.

And thank you so much for your job!

mnico’s picture

Ok, I think I could create the context you mention. Anyway there is another way to use another path to the add form:

1) You could use pathalias or
2) If you can build a module you could implement hook_entity_info_alter() and doing the following:

/**
 * Implements hook_entity_info_alter().
 */
function mymodule_entity_info_alter(&$info) {
  if (isset($info['myentity'])) {
    $crud = &$info['myentity']['bundles']['somebundle']['crud'];
    $crud['add']['path'] = 'mycustompath';
    
  }
}

And the eck_pm will detect this change.

I hope this can help you for now.

mnico’s picture

Status: Reviewed & tested by the community » Needs work

  • mnico committed 7319810 on 7.x-1.x
    Issue #2369217 by mnico: Added eck_add_form context.
    
mnico’s picture

Status: Needs work » Needs review

Or maybe you want to try the new context "ECK Add form" ;)

I hope it works well

rozh’s picture

Status: Needs review » Needs work

Thank you for snippet. You are very helpful.

I've tried context plugin and entity was saved correctly but I've got a notice message.

Notice: Undefined property: ctools_context::$form_title in function ctools_form_content_type_render() (string 36 in file /sites/all/modules/ctools/plugins/content_types/form/form.inc).

I think the cause in "General form" pane, because field panes + submit button pane work fine.

  • mnico committed cd3cba6 on 7.x-1.x
    Issue #2369217 by mnico: Fixed the variable ->form_title.
    
mnico’s picture

Status: Needs work » Needs review

With the last change the message should no longer appear. ;)

rozh’s picture

Status: Needs review » Reviewed & tested by the community

Yes! Everything is great.
I think it's time to add description about new cool feature to project page :)

mnico’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Done ;) thank you