In the status report I get the following error:

  • Edit: theme compatibility
    • Edit's attributes on entities are missing
    • Edit's attributes on fields are missing

I am using oa_radix theme. The site is not in maintenance mode, which I know would cause this error.

In the readme it says:

     - <?php print render($items); ?>
     + <div <?php print $attributes; ?>>
     +   <?php print render($items); ?>
     + </div>

So do I modify the node.tpl.php and panels.tpl.php files?
The system.tpl.php does not have '$attribute'.

Comments

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Status: Active » Postponed (maintainer needs more info)

I just committed a patch that updates the docs: you must apply a patch to use Edit in combination with Panels pages, which is probably the culprit. See #2170199: Document patch required for Panels compatibility.

Let me know if applying that patch fixes the problem.

wrd’s picture

I'm getting this message in status as well. I've applied the patch (we are using Panels, but not on every page), and am still getting the status error.

My theme is built on Omega, so I assume the problem is a lack of an attribute wrapper, but I'm not quite getting from the readme where this needs to be fixed. E.g., we have a node template that hides a couple of fields and then prints render($content); do instances of render($content) need to be wrapped? Or only cases where we're printing individual fields? Or is this something we only need to look at it the actual field template? In which case, if neither the theme nor the base theme has a custom field template, should the system field template be adequate? Thanks!

webavant’s picture

I am also getting this error after installing the current Spark distribution and another module that creates some custom entity types. I have not installed Panels. I am only seeing this on the site status report, and I am not noticing any other problems.

Edit's attributes on fields are missing

Wim Leers’s picture

D'oh, I didn't see this reply! Please mark an issue back as active once you've replied, otherwise I won't see it :)

#2: there have been known problems with Omega: https://drupal.org/project/issues/edit?text=omega&status=All. It's probably this: #1913964: Some themes print the node title in an attribute, thereby breaking HTML, for which the solution is documented: http://drupalcode.org/project/edit.git/commitdiff/eab785a.

#3: the current Spark distribution (7.x-1.x) works fine: nothing in the status report.

wrd’s picture

Thanks; I did edit my couple of custom templates (and added a custom node template) to make the change to titles as mentioned in #1913964, but I'm still getting the error. There is a fair amount of preprocessing going on, both for nodes and fields (we're pulling some data from outside sources and displaying it as if it were part of a node). Is there any way perhaps to use Watchdog in the tests to log which specific fields Edit is finding troublesome? Thanks!

syam.mohan.vs’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc1
Status: Postponed (maintainer needs more info) » Active

I am also using Omega 3.x. I have used you patch and also added the custom node template. But still the problem persists - "Edit's attributes on fields are missing"

Wim Leers’s picture

So you have done what the README says?

i.e.:

Q: The status report says "Edit's attributes on entities are missing" or "Edit's
   attributes on fields are missing.". How do I fix these?
A: Your theme is probably stripping them. Your theme's templates must always
   print "$attributes" for entities and fields. This implies that a wrapper for
   each field is a requirement. If you're not using a wrapper yet for e.g. your
   fields, you'll want to do something like this:
     -<?php print render($items); ?>
     +<div <?php print $attributes; ?>>
     +  <?php print render($items); ?>
     +</div>
syam.mohan.vs’s picture

No. I havenot done that. Please let me know where that code is supposed to go - in which file ?

syam.mohan.vs’s picture

I copied field.tpl.php from drupal core in to /sites/all/themes/mysubtheme/templates/field.tpl.php and provided the extra div around the " print render($items); " section. But still I am getting the same issue. Please help.

Wim Leers’s picture

I can't help you with the given information. Definitely not without access to your site itself. Your theme does things it should not do. It's possible you're using subthemes. So I couldn't possibly give precise directions. You'll have to either give me access to a publicly accessible dev version of your site, or solve it yourself.

hotbeach’s picture

Hi,
I have the same problem, but I'm using Omega 4 theme instead of oa_radix theme.

marshallexcavating’s picture

I am also getting the same error and with the class is missing:

Error
Edit: theme compatibility
Edit's attributes on entities are missing
Edit's attributes on fields are missing
and
Edit's The content region class is missing

I am using the drupal 7 default them Bartik 7.25 (default theme).
I do not have panels installed.
my module list is:
edit
ctools
views
taxonomy_access
adminimal_admin_menu
admin_menu
entity

Is there a Theme avalible for drupal 7 that works with "edit" module with out having to make modificationd in code?

syam.mohan.vs’s picture

Hi

I am using omega 3.x and have created a sub theme. But there are no overrides implemented in the sub theme other than what you have mentioned. I was not having this problem with EDIT before the latest release 7.x-1.0-rc1. I think you can replicate the problem with a fresh install of Drupal and Omega 3.x + Edit 7.x-1.0-rc1. If you still think you need access to our site we will consider it, but it may take time.

Wim Leers’s picture

#12: Bartik works at all times.

#13:

  1. What was the previous release you were using?
  2. Are you using other modules that affect markup, like the Fences module?
Wim Leers’s picture

Together with fubhy (the Omega maintainer), the "content region" problem has been fixed in a theme-independent way: #2178103: Stop requiring a content region wrapper + "region-content" class for maximum theme compatibility. Please try the latest dev snapshot. Or Edit 1.0 RC2 if it's available by the time you read this — I will probably do the RC2 release later today.

wrd’s picture

Latest snapshot is working on my test site (previous versions were not working). However, I'm still getting the error message in the status report indicating that attributes on fields are missing.

I can't give access to this site, but I have a personal site at home that was displaying similar behavior some weeks back. I'll get it updated, make sure it's still doing the same thing, and give access.

Wim Leers’s picture

#16: which version of Omega are you using? It works fine with Omega 4. fubhy, the Omega maintainer tested Edit with it. I also tested Edit with it.

fubhy’s picture

Yes, I can confirm that Omega 4.x works with Edit now (@see https://drupal.org/node/2175461 and https://drupal.org/comment/8395471#comment-8395471 and https://drupal.org/node/2178103 which are now fixed).

The issue described here does not appear for me and anyone else in my office. We can't reproduce it (at least not with the latest Omega 4.x-dev version, please cross-check and confirm if it is now working with Omega 4.x-dev and Edit 2.x-dev).

syam.mohan.vs’s picture

Hi Wim

I have installed the latest version of Edit and cleared my cache. But am still gettingthe issue in status page - "Edit's attributes on fields are missing"

Again I am using Omega 3.x. I am not using other modules that affect mark up like FENCES. The
version of Edit I was using without having the issue was the version before Edit 7.x-1.0-rc1. I dont exactly remember the number.

Please help.

Wim Leers’s picture

Edit + Omega 3 is unsupported. Please upgrade to Omega >=4.3. If you can't do that, then I can't help you. We can't support old versions of every theme. You can make Edit work with Omega 3 for sure, but then you'll need to debug the problem yourself. I've already given plenty of guidance, here and in the README.

wrd’s picture

Yeah, we're still using Omega 3. Omega 4's a very different beast. I've started building with it at home, but getting the State of Missouri to make the switch will require overcoming a lot of momentum. I'll see what I can do. Thanks!

Wim Leers’s picture

I'm sorry, but I'm sure you understand we can't support everything. I'm sure it's possible to get Edit to work with Omega 3, I just don't have the time to figure that out too. Especially because Omega 3 is currently mostly unmaintained.

mikefyfer’s picture

I'm also seeing the two errors:

  • Edit's attributes on entities are missing
  • Edit's attributes on fields are missing

On the status report page using bartik or any other number of themes that are not altering any field.tpl - but seems to be working fine. Is there a reason I'm seeing these errors. I've tried adding a field.tpl and adding the wrappers as outlined in the readme FAQ - but doesn't seem to help the errors go away.

Thanks

Wim Leers’s picture

The reason is that Edit's best-effort attempt to detect whether your theme is doing things it should not do is finding those two problems. I'm sure you can understand we can't go and fix everybody's themes. It's up to you to do that, we already provide plenty of guidance: automatic detection of problematic themes *and* a description of the problem + solution in the README. That should be plenty to help you get started with solving the flaws in your theme.

wrd’s picture

Is there any way to have Edit's detection report to watchdog which entity(ies) and field(s) it is finding the problem in? That would be a big help in tracking down the theme problems (and if we can find some commonalities, may also help us to suggest some further and more detailed examples for the documentation that would help others solve their own theme problems as well).

Wim Leers’s picture

#25: Edit simply tests the first published "node" entity. The code + code comments should speak for themselves:

    // Best-effort check that the theme is compatible.
    $query = new EntityFieldQuery();
    $query
      ->entityCondition('entity_type', 'node')
      ->propertyCondition('status', 1)
      ->range(0, 1);
    $result = $query->execute();
    if (isset($result['node'])) {
      $requirements['edit_theme'] = array(
        'title' => t('Edit: theme compatibility'),
        'value' => t('The theme appears compatible'),
        'severity' => REQUIREMENT_OK,
      );

      // Request the first published node's HTML.
      $node_ids = array_keys($result['node']);
      $node_id = $node_ids[0];
      $response = drupal_http_request(url('node/' . $node_id, array('absolute' => TRUE)));

      $dom = new \DOMDocument();
      @$dom->loadHTML($response->data);
      $xpath = new \DOMXPath($dom);

      $errors = array();

      // There should be at least one DOM element with a data-edit-entity-id
      // attribute that begins with "node/<node ID>". "at least one" because
      // there may be multiple entities on this page.
      if ($xpath->query("//*[starts-with(@data-edit-entity-id, 'node/" . $node_id . "')]")->length == 0) {
        $errors[] = t("Edit's attributes on entities are missing");
      }

      // There should be at least as many DOM elements with a data-edit-field-id
      // attribute that begin with "node/<node ID>" as there are visible fields
      // in the default view mode. "at least as many", because it is impossible
      // for code to know whether the "date" and "author" fields are visible,
      // but also because there may be multiple entities on the page.
      $bundle = $result['node'][$node_id]->type;
      $instances = field_info_instances('node', $bundle);
      $visible_field_count = 0;
      $node = entity_load_single('node', $node_id);
      foreach ($instances as $field_id => $instance) {
        if (!empty($node->$field_id) && $instance['display']['default']['type'] != 'hidden') {
          $visible_field_count++;
        }
      }
      $node_type = node_type_get_type($bundle);
      if ($node_type->has_title) {
        $visible_field_count++;
      }
      if ($xpath->query("//*[starts-with(@data-edit-field-id, 'node/" . $node_id . "')]")->length < $visible_field_count) {
        $errors[] = t("Edit's attributes on fields are missing");
      }

      if ($errors) {
        $requirements['edit_theme']['value'] = theme('item_list', array('items' => $errors));
        $requirements['edit_theme']['severity'] = REQUIREMENT_ERROR;
      }
    }
Wim Leers’s picture

#26: also, I just made a commit (i.e. after RC2 was released) that fixes one bug in the theme compatibility check.

And I'd like to stress that this is a best-effort test. It could be that it's working fine yet the status report complains, though unlikely. Please give it a try :)

incarnated’s picture

I realise this is just a best-effort test, but thought I'd note I've been getting failures because the drupal_http_request is being blocked by our internal proxy.

Maybe a check of the $response->code would help to account for these situations.

Wim Leers’s picture

#28: oh, great catch! That's definitely something that should be caught.

SocialNicheGuru’s picture

I am using oa_radix and I am still getting the error.

Edit: theme compatibility

Edit's attributes on entities are missing
Edit's attributes on fields are missing

I have done what the readme says which does not help.

Wim Leers’s picture

#30: then please set up an instance of that site that I can access publicly, so that I can look into it. You can use my d.o contact form to send me login details.

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)
SocialNicheGuru’s picture

I am going to close this one out.

This has to do with panelizer. If panelizer is enabled for a content type then the getattribute error occurs and none of the fixes work.

SocialNicheGuru’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
btopro’s picture

Version: 7.x-1.0-rc1 » 7.x-1.0
Category: Support request » Bug report
Status: Closed (works as designed) » Needs work
Issue tags: +authenticated user

I think I see the problem. the install requirements function is issuing a drupal_http_request against the 1st published node. That makes an anonymous call against the first page which in my case, is only available to authenticated users. This is most likely the case in Atrium as well since much of the system involves private group nodes / nodes associated to groups.

I'm not sure there's a good way around this given the current method of http request. Some ideas:
-- try to render a page using a different method like a theme function or drupal_render
-- do a node access check / change the EFQ to have the meta property of user uid = 0 (better chance of returning something that's web accessible)
-- change the message / README to indicate that private sites can deliver false positives

In my case at least, theme is working it's just reporting it won't work; guessing that is true on radix unless it's extreme.

Aalandriel’s picture

I think #35 might be spot on in terms of authentication. Putting the site in maintenance mode will cause this "issue" as well.

Wim Leers’s picture

Status: Needs work » Closed (duplicate)

#35 & #36: thanks for the excellent feedback! I've solved this and more at #2188223: Edit's theme compatibility doesn't work when the site requires HTTP authentication or prevents anonymous users from accessing content :)

That was the last problem raised in this issue, so now I can finally close this :)

drupshop’s picture

Hello to make this work you may add the field.tpl.php in to your theme folder and edit line

<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>

to

<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><div <?php print $attributes; ?>><?php print render($item); ?></div></div>

In drupal 7 it is work

crantok’s picture

Issue summary: View changes

This issue was top of google today for the status report error. I've added a note to the description ruling out the site being in maintenance mode. That was what caused the problem for me and I didn't find out until I inspected the html response in the requirements test (*blush*), after which I saw #36 by Aalandriel.

srikanth.g’s picture

https://www.drupal.org/project/quickedit
I am trying to use above module in drupal 7.41 with core default theme and modules,but getting the following error on Status report page.

"Quick Edit: theme compatibility Could not determine compatibility.
When a site does not allow anonymous users to access content, requires HTTP authentication or something similar, Quick Edit module is unable to automatically determine compatibility"

Backbone library 1.2.3 (minified) Underscore library 1.8.3 (minified), php 7.0.0RC6 bitnami wamp stack

johnnieg’s picture

After trying these solutions including adding a field.tpl.php file to the theme, I was still missing the data-quickedit-entity-id and data-quickedit-entity-instance-id attributes. I compared the html output of a page using my theme with the page using Bartik and found that this line that Quickedit seems to require, at the top of the theme's node.tpl.php file, was wrapped in a conditional statement like this:

<?php if (!$page): ?>
  <article id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php endif; ?>

Quickedit works after removing the IF statement.