Skip to content

Instantly share code, notes, and snippets.

@loulou2u
Created June 28, 2016 17:27
Show Gist options
  • Save loulou2u/b27638cb7636de5bd5567d5c8b0c6c67 to your computer and use it in GitHub Desktop.
Save loulou2u/b27638cb7636de5bd5567d5c8b0c6c67 to your computer and use it in GitHub Desktop.
<?php
// PHP functionality for a redundant checkbox above the group suggest selector box, providing a shortcut for users to suggest to a specific chosen group (like the homepage or main communications team).
$_LW->REGISTERED_APPS['suggest_to']=array(
'title'=>'suggest_to',
'handlers'=>array('onLoad','onOutput'),
'custom'=>array(
'label'=>'Suggest to main calendar' // Customize checkbox label as appropriate
)
); // configure this module
class LiveWhaleApplicationSuggestTo {
public function onLoad() {
global $_LW;
// load custom backend CSS and JS
$_LW->REGISTERED_JS[]=$_LW->CONFIG['LIVE_URL'].'/resource/js/suggest_to%5Csuggest_to.js';
}
public function onOutput($buffer) {
global $_LW;
// if on the events editor pages or news editor page
if ($_LW->page =='events_edit' || $_LW->page =='events_sub_edit' || $_LW->page =='news_edit') { // define pages to target with this transformation
$buffer = str_replace(
'<fieldset id="suggest">',
'<fieldset id="suggest">
<div class="checkbox" id="main_group_share">
<label><input type="checkbox" value="1"/>'.$_LW->REGISTERED_APPS['suggest_to']['custom']['label'].'</label>
</div>',
$buffer
);
};
return $buffer;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment