3.2.x 3.2.x SnippetsChanges to add collapse into your exts if author has not updated them

Snippets
Previous topicNext topic
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Topic Author
martin
Admin
Admin
Status: Offline
User theme: Dark
Posts: 5123
Joined: Apr 6th, '14, 14:12
    Linux Chrome

Changes to add collapse into your exts if author has not updated them

Post by martin »

New code
html

Code: Select all

{% if FOO_IS_COLLAPSIBLE %}
                        <a href="{{ U_FOO_COLLAPSE_URL }}"
                                         class="collapse-btn foo-collapse"
					   data-hidden="{{ S_FOO_HIDDEN }}"
					   data-ajax="phpbb_collapse"
					   data-overlay="true"
					   data-title-alt="{{ lang('FOO_COLLAPSE_TITLE', ((not S_FOO_HIDDEN) * 1)) }}"
					   title="{{ lang('FOO_COLLAPSE_TITLE', (S_FOO_HIDDEN * 1)) }}">
						<i class="fa {% if S_FOO_HIDDEN %}fa-plus-square{% else %}fa-minus-square{% endif %}"></i>
					</a>
			{% endif %}
lang

Code: Select all

	'FOO_COLLAPSE_TITLE'			=> [
		0 => 'Hide foo',
		1 => 'Show foo',
	],
Foo being the name of the ext.
Image

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

ivailo95
Users
Users
Status: Offline
User theme: Dark
Posts: 919
Joined: Feb 2nd, '18, 11:04
    Windows 7 Opera

Re: Changes to add collapse into your exts if author has not updated them

Post by ivailo95 »

so if i want to collapse copyright i need to use this code? :question:
Feed like a disease
And bring them to their knees
They'll pay for their deceit

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

dmzx
Founder
Founder
Status: Offline
User theme: Dark
Posts: 6485
Joined: Jan 13th, '14, 20:45
    Windows 10 Chrome

Re: Changes to add collapse into your exts if author has not updated them

Post by dmzx »

ivailo95 wrote: Oct 10th, '19, 08:50 so if i want to collapse copyright i need to use this code? :question:
Hmm if also the listener has the correct code.

What you see above is the html and lang edits only....

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/src/Template.php on line 359: Array to string conversion
Array

Topic Author
martin
Admin
Admin
Status: Offline
User theme: Dark
Posts: 5123
Joined: Apr 6th, '14, 14:12
    Linux Chrome

Re: Changes to add collapse into your exts if author has not updated them

Post by martin »

I'm using this to allow collapse off the index

Code: Select all

public function collapse($event)
	{
		if ($this->operator !== null)
		{
			$fid = 'foo'; // can be any unique string to identify your extension's collapsible element
			$this->template->assign_vars(array(
				'S_FOO_HIDDEN' => $this->operator->is_collapsed($fid),
				'U_FOO_COLLAPSE_URL' => $this->operator->get_collapsible_link($fid),
			));
		}
	}

Previous topicNext topic