PHP code example of contentreactor / craft-block-collapse
1. Go to this page and download the library: Download contentreactor/craft-block-collapse library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
contentreactor / craft-block-collapse example snippets
return [
// Defaults for users who haven't picked their own
'collapseShortcut' => 'ctrl+comma',
'expandShortcut' => 'ctrl+period',
// Add the buttons to element edit screens
'enableButtons' => true,
// Bind the keyboard shortcuts
'enableShortcuts' => true,
// Let users override the defaults under My Account → Preferences
'allowUserOverrides' => true,
// Hide the buttons on pages without collapsible blocks
'hideWhenEmpty' => true,
];
use ContentReactor\BlockCollapse\events\RegisterBlockProvidersEvent;
use ContentReactor\BlockCollapse\models\BlockProvider;
use ContentReactor\BlockCollapse\services\Providers;
use yii\base\Event;
Event::on(
Providers::class,
Providers::EVENT_REGISTER_BLOCK_PROVIDERS,
function(RegisterBlockProvidersEvent $event) {
$event->providers['super-field'] = new BlockProvider([
'handle' => 'super-field',
'label' => 'Super Field',
'blockSelector' => '.super-field .super-block',
'strategy' => BlockProvider::STRATEGY_CLASS_TOGGLE,
'collapsedClass' => 'is-collapsed',
]);
}
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.