Commit 9d4a3d9c authored by marcvangend's avatar marcvangend

start refactoring fieldblock_get_block_list

parent 5b25b278
......@@ -20,8 +20,8 @@ function fieldblock_form_field_ui_display_overview_form_alter(&$form, &$form_sta
$bundle = $form['#bundle'];
$mode = $form['#mode'];
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $view_mode_config */
$view_mode_config = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $entity_view_display */
$entity_view_display = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
// Add a column header.
$form['fields']['#header'][] = t('Display as block');
......@@ -31,7 +31,7 @@ function fieldblock_form_field_ui_display_overview_form_alter(&$form, &$form_sta
foreach ($field_names as $field_name) {
$form['fields'][$field_name]['fieldblock'] = array(
'#type' => 'checkbox',
'#default_value' => $view_mode_config->getThirdPartySetting('fieldblock', $field_name) ? true : false,
'#default_value' => $entity_view_display->getThirdPartySetting('fieldblock', $field_name) ? true : false,
'#title' => '',
);
}
......@@ -92,12 +92,17 @@ function fieldblock_field_display_submit($form, FormStateInterface $form_state)
function fieldblock_get_block_list() {
$fieldblocks = &drupal_static(__FUNCTION__);
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $view_mode_config */
// $view_mode_config = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
$view_mode_configs = EntityViewDisplay::loadMultiple();
$foo = 'bar';
if (!isset($fieldblocks)) {
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $view_mode_config */
$entity_view_displays = EntityViewDisplay::loadMultiple();
foreach ($entity_view_displays as $name => $entity_view_display) {
// ToDo: This is not cool, I want a way to get all thirdpartysettings at once!
$fieldblock_settings = $entity_view_display->getThirdPartySetting('fieldblock');
}
$fieldblocks = array();
$config_names = \Drupal::configFactory()->listAll('fieldblock.');
foreach ($config_names as $config_name) {
......
......@@ -18,7 +18,7 @@ class FieldBlock extends DeriverBase {
/**
* {@inheritdoc}
*/
public function getDeriverDefinitions($base_plugin_definition) {
public function getDerivativeDefinitions($base_plugin_definition) {
$blocks = fieldblock_get_block_list();
foreach ($blocks as $fieldblock_id => $description) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment