Created
June 18, 2015 16:57
Matrix Collapse Plugin, put this in a folder called "matrixcollapse" in craft/plugins/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Craft; | |
/** | |
* Matrix Collapse Plugin. | |
*/ | |
class MatrixCollapsePlugin extends BasePlugin | |
{ | |
/** | |
* Get plugin name. | |
* | |
* @return string | |
*/ | |
public function getName() | |
{ | |
return Craft::t('Matrix Collapse'); | |
} | |
/** | |
* Get plugin version. | |
* | |
* @return string | |
*/ | |
public function getVersion() | |
{ | |
return '1.0.0'; | |
} | |
/** | |
* Get plugin developer. | |
* | |
* @return string | |
*/ | |
public function getDeveloper() | |
{ | |
return 'Bob Olde Hampsink'; | |
} | |
/** | |
* Get plugin developer url. | |
* | |
* @return string | |
*/ | |
public function getDeveloperUrl() | |
{ | |
return 'http://github.com/boboldehampsink'; | |
} | |
/** | |
* Include JS to collapse Matrix Blocks | |
*/ | |
public function init() | |
{ | |
if(craft()->request->isCpRequest()) { | |
craft()->templates->includeJs("$('.matrixblock').each(function(){$(this).addClass('collapsed');Craft.MatrixInput.rememberCollapsedBlockId($(this).data('id'));});"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment