You are here

function blocktheme_get_blockthemes in Block Theme 8

Same name and namespace in other branches
  1. 6 blocktheme.module \blocktheme_get_blockthemes()
  2. 7 blocktheme.module \blocktheme_get_blockthemes()

Get the defined blockthemes and return an array to be used in a select list.

3 calls to blocktheme_get_blockthemes()
blocktheme_form_basic_block_content_form_alter in ./blocktheme.module
Form for adding a new block.
blocktheme_form_block_form_alter in ./blocktheme.module
Form for updating a block.
blocktheme_get_theme_name in ./blocktheme.module
Get template name of block.

File

./blocktheme.module, line 255
Provides a configuration option to select custom themes for blocks

Code

function blocktheme_get_blockthemes() {
  $options = array();
  $config = Drupal::config('blocktheme.settings');
  $blockthemes = $config
    ->get('blocktheme_themes');
  $options[] = t('- None -');
  if ($blockthemes) {
    $_sets = explode("\n", $blockthemes);
    foreach ($_sets as $key => $value) {
      $set = explode('|', $value);
      $options[$set[0]] = $set[1];
    }
  }
  return $options;
}