Skip to content

Instantly share code, notes, and snippets.

@sjelfull
Last active August 29, 2015 14:25
Show Gist options
  • Save sjelfull/ed0023ab3e4ce9d63f35 to your computer and use it in GitHub Desktop.
Save sjelfull/ed0023ab3e4ce9d63f35 to your computer and use it in GitHub Desktop.
Craft CMS: Simple (and not very well tested!) plugin to move the title field to the settings pane.
<?php
namespace Craft;
class TitleToSettingsPanePlugin extends BasePlugin {
/**
* Returns the plugin’s name.
*
* @return string The plugin’s name.
*/
public function getName()
{
return Craft::t('Title To Settings Pane');
}
/**
* Returns the plugin’s version number.
*
* @return string The plugin’s version number.
*/
public function getVersion()
{
return '1.0';
}
/**
* Returns the plugin developer’s name.
*
* @return string The plugin developer’s name.
*/
public function getDeveloper()
{
return 'Jeroen Kenters';
}
/**
* Returns the plugin developer’s URL.
*
* @return string The plugin developer’s URL.
*/
public function getDeveloperUrl()
{
return 'http://buildwithcraft.com';
}
public function init()
{
if ( craft()->request->isCpRequest() && craft()->userSession->isLoggedIn() )
{
// check if this is an edit/create entry request
$path = explode('/', craft()->request->getPath());
if($path[0] == 'entries')
{
craft()->templates->includeJs('$(function(){$(\'#title-field\').prependTo(\'#settings\');});');
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment