Jump to content

Hiding an element with a plugin / CSS selector trouble


Matt Summers

Recommended Posts

Posted

I'm having a really frustrating experience with this "CSS selector" feature. I'm simply trying to disable the "Show results" button in polls.

I can successfully control other elements of the poll's rendering, but anything "deep" doesn't seem to be targetable. I've tried the built in picker. I've tried manual selectors. I've verified in a browser that they select one and only one correct element. It simply doesn't do anything.

What am I not understanding?

Example #1: Replacing the entire pollcontents works

div.ipsPad.ipsClearfix[data-role='pollContents']

image.png.69681d7258f99841d576ebb5a8606e37.png

Correct:

image.png.5c922b9c0f4bfb9ed6bbe644053b7650.png

Example #2: div.ipsPad.ipsClearfix[data-role='pollContents'] ol.ipsList_reset.cPollList

Doesn't do anything. I can confirm this selector works in jQuery and picks the correct item.

Example #3: a[data-action=viewResults]

Targeting the button directly with a super simple selector doesn't work either

Example #4: Targeting just a simple h2 works

image.png.e74ef4b88633e145b90958d66226d763.png

I am absolutely baffled. Can anyone give me a push in the right direction?

Thanks

Posted

As is typical with these sorts of problems, I figured it out shortly after throwing in the towel and posting about it.

Just as I was about to close down for the evening, I noticed that form.phtml calls another template to render the <form> version of the poll. The 'pollForm' template is where that particular button actually existed.

{$pollForm->customTemplate( array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' ), 'pollForm' ), $url, $poll )|raw}

And sure enough, changing my plugin to hook both poll and pollform worked.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...