Hello

My plugin add support of entities into page manager.
Just add Entity panes content type and select the build mode to make it work.

Please review.

Comments

fago’s picture

Status: Needs review » Needs work

thanks, here a review:

+++ b/ctools/content_types/entity_panes.inc
@@ -0,0 +1,119 @@
+  'title' => t('Entity panes'),

hm, that doesn't say whether it'S the form or whatever. Maybe we should say "entity view", "entity display" or so? How is that called for nodeS?

+++ b/ctools/content_types/entity_panes.inc
@@ -0,0 +1,119 @@
+  $entity_type = $form_state['subtype_name'];

hoo, from where comes that value? Magic!?

+++ b/ctools/content_types/entity_panes.inc
@@ -0,0 +1,119 @@
+ * Copy view_mode from our defaults.

It's more saving the form values, not?

+++ b/ctools/content_types/entity_panes.inc
@@ -0,0 +1,119 @@
+  $block = new stdClass();
+  $block->module = 'entity';
+  $block->delta = $entity_type . '-' . $conf['view_mode'];

Does ctools require this block stuff?

+++ b/ctools/content_types/entity_panes.inc
@@ -0,0 +1,119 @@
+  return t('Entity panes: @entity_name [@view_mode]',array('@entity_name' => $entity_name, '@view_mode' => $view_mode));

Minor, but it's the entity type name.

bennetteson’s picture

Status: Needs work » Needs review
StatusFileSize
new4.48 KB

Tks for your review,
Here a patch with a little more comments.
I updated the patch to match somes of yours reviews.

amitaibu’s picture

Status: Needs review » Needs work

Minor stuff:

+++ b/ctools-content_types/entity_display.incundefined
@@ -0,0 +1,127 @@
+  $block->delta = $entity_type . '-' . $conf['view_mode'];

We probably need to str_replace ('_', '-', $conf['view_mode'])

+++ b/entity.moduleundefined
@@ -1227,3 +1227,12 @@ function _entity_info_add_metadata(&$entity_info) {
+ * Implementation of hook_ctools_plugin_directory().

Should be Implements ...

bennetteson’s picture

Status: Needs work » Needs review
StatusFileSize
new4.5 KB

You're right. Thanks for your review.
Here a new path.
Review welcome.

fago’s picture

Status: Needs review » Needs work
+++ b/ctools-content_types/entity_display.inc
@@ -0,0 +1,127 @@
+ * Content type plugin to allow Entity to be exposed as a display type,
+ * Build mode configuration still available.

build mode? It's view mode. Then, it's no proper sentence.
We are not referring the the Entity module, so Entity should be lowercase.

+++ b/ctools-content_types/entity_display.inc
@@ -0,0 +1,127 @@
+function entity_entity_display_content_type_content_type($entity_type) {

Why content_type_content_type? I guess one should be entity_type. And why do we have that ugly entity_entity prefixes?

+++ b/ctools-content_types/entity_display.inc
@@ -0,0 +1,127 @@
+ * Entity Display use entity types machine name  as subtype name.

display should be lower case, double spacing behind name.

+++ b/ctools-content_types/entity_display.inc
@@ -0,0 +1,127 @@
+ * Entity Display use entity types machine name  as subtype name.

again.
Then @see does not follow the coding style. Needs an empty line before it and no color or tailing point.

+++ b/ctools-content_types/entity_display.inc
@@ -0,0 +1,127 @@
+ * @see : ctools_content_render().

again @see coding style.

+++ b/entity.module
@@ -1227,3 +1227,12 @@ function _entity_info_add_metadata(&$entity_info) {
+  if ($module == 'ctools' && $plugin == 'content_types') {
+    return 'ctools-content_types';

Let's use the directory 'ctools/content_types'.

bennetteson’s picture

Status: Needs work » Needs review
StatusFileSize
new4.49 KB

Thanks for your review.

build mode? It's view mode. Then, it's no proper sentence.
We are not referring the the Entity module, so Entity should be lowercase.

Done.

Why content_type_content_type? I guess one should be entity_type. And why do we have that ugly entity_entity prefixes?

Move to content_type_info.
If you don't want the ugly entity_entity prefixe, I can move the plugin manchine name form entity_display to display.

display should be lower case, double spacing behind name.

Done.

again.
Then @see does not follow the coding style. Needs an empty line before it and no color or tailing point.

Done.

again @see coding style.

Done.

Let's use the directory 'ctools/content_types'.

Done.

Please review.

fago’s picture

>If you don't want the ugly entity_entity prefixe, I can move the plugin manchine name form entity_display to display.

oh, I see the entity_entity namespace comes from entity_display being again prefixed by ctools... In that case, let's keep it that way. Patch visually looks good, just needs a positive test report..

fago’s picture

Status: Needs work » Needs review

ok, tested it. When I clicked on preview in page-manager/panels I got this:

Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of ..../drupal-7/sites/all/modules/entity/includes/entity.controller.inc).
EntityMalformedException: Missing bundle property on entity of type profile2. in entity_extract_ids() (line 7410 of ..../drupal-7/includes/common.inc).

I tested it with profile2. Then in the UI the plugins are listed below "Entity display", although there is already a "Profile2" category for the fields. So what about adding in to the "Profile2" category and call it "Entity display" there? I think people what look for something like that there.

I'm not sure yet about the "entity display" working. Sry about coming back to this again, but we need to come up with unified wording for that once, so we can start using it everywhere.

Options:
"Entity view" -> unspecific, unclear whether it's a view?
"Entity display"
"Entity" -> It should be clear it's rendered, not?
"Rendered entity"

I tend to "Entity" (rendered using view mode "foo"). In code it should be "entity_view" I guess as that's the name of the function already.

fago’s picture

Status: Needs review » Needs work
fago’s picture

amateescu: fago: I vote for "Rendered entity", it's consistent with what's currently in file_entity.module
Damz told me "entity reference" also uses "Rendered entity".

So let's just follow that and use "Rendered $entity-type", e.g. "Rendered profile" and "entity_view" as plugin machine name.

bennetteson’s picture

Status: Needs review » Needs work

Hi fago,

Can you give me the list of used module and version ? I will try to reproduce the bug.

fago’s picture

I've used the latest dev version of profile2.

andypost’s picture

Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of ..../drupal-7/sites/all/modules/entity/includes/entity.controller.inc).

Probably depends on #1229320: Entity context: Impossible to load entities with non-numeric IDs

bennetteson’s picture

Status: Needs review » Needs work
StatusFileSize
new4.46 KB

The bug seem to not came from my patch.
I not succeed to reproduce your bug.
Here the others corrections are here.

bennetteson’s picture

Status: Needs work » Needs review
BenjaminRH’s picture

Status: Needs work » Needs review
fago’s picture

Status: Needs review » Fixed

thanks, I've polished some comments and improved the title/categorization of the plugins and committed it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

raulmuroc’s picture

Status: Closed (fixed) » Fixed

Patch from #14 doesn't apply to 7.x-1.x-dev version of 28-FEB-2012. It should apply, shouldn't it?

And if I download the last 7.x-1.x-dev and upload it to my websites, it just break them down.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

raulmuroc’s picture

Status: Closed (fixed) » Fixed

So we must interpret that patch has been included in last stable version of ctools?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.