Hey awesome work on the 3.x branch love it!

I am just having a small problem with using Panels in place editor with Adaptive Theme. It seems for some reason certain li classes are not rendering when I use adaptivetheme. I have attached screenshots showing where exactly the missing classes are for my specific use case.

Normally I was thinking this would be a problem to bring to panels attention but since the in place editor works in bartik and a few other themes I think it is an issue with AdaptiveTheme. I am just using a default drush enabled sub theme right now.

---

UPDATE

I took a wild guess and removed adaptivetheme_links in theme.inc and the icons all appeared with the correct li classes. This is because panels_ipe.module calls theme_links in line 125-129

  $attributes = array(
    'class' => 'panels-ipe-linkbar',
  );

  $links = theme('links', array('links' => $links, 'attributes' => $attributes));

I did some further debugging with xdebug and found the problem had to do with the the following code: at_get_setting('extra_menu_classes') line 391 in theme.inc

Changing the assignment === operator

      if (at_get_setting('extra_menu_classes', $theme_name) === 1) {
        $class = array($key);
        if ($i == 1) {
          $class[] = 'first';
        }

To this

      if (at_get_setting('extra_menu_classes', $theme_name) == 1) {
        $class = array($key);
        if ($i == 1) {
          $class[] = 'first';
        }

Fixed the problem and all the proper li classes got populated. I do realize the === is perfectly valid but confused bout what is going on.

Comments

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Title: AdaptiveTheme Breaks Icons Display for Panels In Place Editor (missing li classes) » AdaptiveTheme 3.X Missing li classes cause of === operator (Use Case: Panels In Place Editor)

Changing title

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Issue summary: View changes

Edit

sylus’s picture

Component: Module Support » Theme Settings
Category: support » bug

Hopefully not missing anything but looks like a bug so changing from support request. Can move back if inappropriate.

sylus’s picture

Issue summary: View changes

Edit

Jeff Burnz’s picture

Title: AdaptiveTheme 3.X Missing li classes cause of === operator (Use Case: Panels In Place Editor) » Change comparison operator in theme_links

How odd, I use this operator extensively because its faster to check equality and type, I assume this must be a string. No problems, easy fix.

Jeff Burnz’s picture

I'm looking at this and wondering why my In Pace Editor looks nothing like yours - the screenshots show a nice styled editor with gradient and icons, mine looks like crap - its purple with budget styles all round. I have never used this, can you advise?

sylus’s picture

Hey Jeff I am working off of the panopoly distribution trying to extend it with adaptive theme because would be a killer combination. I didn't think though that panopoly included work on making the in place editor more clean looking though. Sorry should have pointed that out. Do you still have the class loading problems? did u try panels dev release?

sylus’s picture

It seems I am having problems wherever there is the === operator. For instance none of my breadcrumbs are also showing up.

Traced to line 90 in theme.inc in

if (at_get_setting('breadcrumb_display', $theme_name) === 1) 

Except in the subtheme info breadcrumb_display is set to "yes"

Setting breadcrumb_display to 1 (in subtheme info) and changing === to == in theme.inc for breadcrumb function made the breadcrumb appear and work properly.

Jeff Burnz’s picture

The breadcrumb being "yes" is an odd reversion, I know I updated that at some stage so its been reverted somewhere along the way.

Let me know if you have any other issues, I do not want to change all the comparison operators at this stage, I use equality + type all over the place and no one else has mentioned such issues. For example even if the default value is "yes" and you check the setting it will save as value 1 (an integer). Type checking seems problematic on your system, because I cannot reproduce either of the issues you have described - not with breadcrumb or the In Place Editor classes.

Maybe if there is a way for you to share your database and theme with me, either send it to my email using the contact form or skype me etc, jmburnz. Tell me what operating system you are using and version of PHP etc.

sylus’s picture

I will give it a shot on another stack right now I am using Acquia's Dev Desktop on Mac OS X. Definitely type checking is failing for me though, will take a further look. If nothing works I can share with you the make file ^_^ Will get back shortly.

sylus’s picture

I switched to PHP 5.3.9 and the issue still persists. I compared with the Zen theme and noticed that it only uses theme_get_setting('value') == 1.

Looking further into the === operator I did read this comment in php.net though not sure if correct.

The difference between == and === is that === never does any type conversion. So, while, according to documentation, ("+0.1" === ".1") should return true (because both are strings and == returns true), === actually returns false (which is good).

sylus’s picture

STEPS TO REPRODUCE

1) Install Acquia Dev Desktop (Use any Version of PHP 5.2 or 5.3 from interface)
2) In Default Drupal Install add AdaptiveTheme to /sites/all/themes/ (can even create subtheme)
3) Set breakpoint in any function in sites/all/theme/adaptivetheme/inc/theme.inc using === operator (for instance breadcrumb)
4) Run XDebug and notice never enters the conditional

Jeff Burnz’s picture

I asked to see your files and database, at this stage that is what I really need.

sylus’s picture

Hey Jeff sure i'll message you on skype with the files. Ill just give you a default drupal 7 + adaptivetheme install with the database as would probably be the simplest to debug.

Thanks in advance for taking the time to look into this!

fenstrat’s picture

Title: Change comparison operator in theme_links » Make theme generated CSS files dir configurable
Category: bug » feature
Status: Active » Needs work

I have seen this issue with missing IPE editor icons in AT, however I can't seem to reproduce it now.

The IPE (vastly improved in panels-7.x-3.1) looks like this out of the box, as far as I know there's no custom Panopoly additions to it.

fenstrat’s picture

Title: Make theme generated CSS files dir configurable » Change comparison operator in theme_links
Category: feature » bug
Status: Needs work » Active

Baah, reverting changes, silly Dreditor.

Petemoss’s picture

I don't see this problem in my Panels in-place editor or breadcrumb (no Panopoly distribution, just normal Panels in a standard typical D7 installation). My guess is this looks like a conflict due to Panopoly distro customization or something else.

fenstrat’s picture

@Petemoss Yeah this certainly could be a conflict with Panopoly. However as I said I've seen this same issue without Panopoly. However as I can't replicate it now then it's an academic point really.

Jeff Burnz’s picture

Well, prior to yesterday nuking the icons would have been entirely reproducible, simply by turning OFF the Extra Menu Classes in theme settings - that would have removed all classes/attributes from link items and killed the icons. However, I actually removed the entire theme_links override because, in short, it wasn't really doing much.

I think the main issue being asked about is the ubiquitous failure of the === operator, which I cannot reproduce, and certainly would have noticed over the last 4 months of development. I made the decision really early on to use equality + type checking because its faster (up to 25% faster than ==), and in places where this was not an option its not used. Yes this is micro-optimization but this theme strives for performance in every nook and cranny.

I have been very mindful of this operator and potential issues. The main problem for me in dealing with this particular issue is not being able to reproduce it.

Jeff Burnz’s picture

Title: Change comparison operator in theme_links » Change comparison operators

Updating title, theme_links is not overridden in latest dev.

sylus’s picture

Hey Jeff indeed the latest version of adaptive theme has fixed the issue with Panopoly Icons. Your correct that the issue only concerns itself with the === operator.

I have sent you a message on skype so can send relevant files when your online next.

I am going to delve further into this myself as you state been using this for 4 months with no issue so definitely has to be a problem on my end. I am going to give it a shot on MAMP today and see if that makes a difference ^_^

We can probably close this issue for now as seems to only be related to my setup (Acquia Dev) ?

sylus’s picture

Status: Active » Fixed

Hey! I don't know if anything changed in some of the recent commits of AT or even in my own code but everything looks to be working now and I no longer experience any problems! Woot!

Regardless I really appreciate your help! :)

Hopefully I can return the favor!

Jeff Burnz’s picture

Awesome, thanks for the heads up sylus.

Jeff Burnz’s picture

Title: Change comparison operators » Type juggle settings?
Status: Fixed » Active

I wonder if for pure safety we might type juggle the checkbox settings, one way I think we could away with this is doing in at_get_settings(), which is AT's replacement for Drupal cores theme_get_setting().

I've dug right into this after more poking by sylus and to be honest, it is a bit baffling with regards to how and where the checkbox values are cast. The array_merge() in at_get_setting() is strait from theme_get_setting(), it works mostly the same, so I do not think this is a theme specific issue, other than using stricter comparison operators than most other themes.

      // Type juggle numeric strings, cast to integer
      foreach ($cache[$theme] as $setting_name => $setting_value) {
        if (is_numeric($setting_value) && strlen($setting_value) == 1) {
          $cache[$theme][$setting_name] = (int) $setting_value;
        }
      }
Jeff Burnz’s picture

I had to release RC4 due to an issue with panels settings so I pushed this into the release. I tested this heavily and it shouldn't make any difference, at least theoretically speaking, since AT always tests checkbox settings as if they are type integer, and this implicitly casts any setting that is numeric and 1 char string to integer (I cant really think of safer way of testing for such settings than this, if you can, I am all ears).

Its possible we could get away with either of those function calls (I mean just one, either is_numeric() or strlen(), since I do not believe I have use any numeric settings other than these checkbox settings, and certainly I do not think I used a single char string anywhere.

sylus’s picture

Status: Active » Fixed

Everything works on my end now not sure which code fixed the problem but everything works great now :)

Jeff Burnz’s picture

Status: Fixed » Closed (fixed)

Cleaning up.

Jeff Burnz’s picture

Issue summary: View changes

Edit