* @param int $row Row to add button to (1 to 10)
* @param string $button Identifier of button/plugin
* @param string $before Adds button directly before the named plugin
- * @param bool $alwaysadd If specified $after string not found, add at start
+ * @param bool $alwaysadd If specified $before string not found, add at start
* @return bool True if added
*/
protected function add_button_before(array &$params, $row, $button,
return true;
}
- // Try to add after given plugin.
+ // Try to add before given plugin.
$params[$field] = preg_replace('~(,|^)(' . preg_quote($before) . ')(,|$)~',
'$1' . $button . ',$2$3', $old);
if ($params[$field] !== $old) {
return $row;
}
for($i=$row; $i>=1; $i--) {
+ $field = 'theme_advanced_buttons' . $i;
if (isset($params[$field])) {
- return $row;
+ return $i;
}
}
// This should not happen.