Skip to content

Instantly share code, notes, and snippets.

@sdboyer
Last active December 16, 2015 08:19
Show Gist options
  • Save sdboyer/5404920 to your computer and use it in GitHub Desktop.
Save sdboyer/5404920 to your computer and use it in GitHub Desktop.
block title getting
<?php
class BlockBase {
/**
* {@inheritdoc}
*/
final public function getTitle() {
// Override titles should supersede native title logic.
if (isset($this->configuration['label'])) {
// @todo tokenization?
}
else {
return $this->doGetTitle();
}
}
/**
* Returns a title for the block based on some native block logic.
*
* This method is intended for overriding by subclasses in order to provide
* their own logic for generating the block title.
*
* @see BlockBase::getTitle()
*
* @return string
*/
protected function doGetTitle() {
// @todo make this abstract instead
return '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment