diff --git a/block_class.routing.yml b/block_class.routing.yml index 6e90387..0f33b5f 100644 --- a/block_class.routing.yml +++ b/block_class.routing.yml @@ -45,6 +45,14 @@ block_class.class_list: requirements: _permission: 'administer block classes' +block_class.attribute_list: + path: '/admin/config/content/block-class/attribute-list' + defaults: + _controller: '\Drupal\block_class\Controller\BlockClassController::attributeList' + _title: 'Attribute List' + requirements: + _permission: 'administer block classes' + block_class.list: path: '/admin/config/content/block-class/list' defaults: diff --git a/src/Controller/BlockClassController.php b/src/Controller/BlockClassController.php index 84bd41c..6c6a0a9 100644 --- a/src/Controller/BlockClassController.php +++ b/src/Controller/BlockClassController.php @@ -294,6 +294,55 @@ class BlockClassController extends ControllerBase { } + /** + * Method to show the attribute list. + */ + public function attributeList() { + + $table = ''; + $table .= ''; + $table .= ''; + $table .= ''; + $table .= ''; + $table .= ''; + $table .= ''; + + $attributes_inline = []; + + $config = $this->configFactory->getEditable('block_class.settings'); + + // Get config object. + if (!empty($config->get('attributes_inline'))) { + $attributes_inline = $config->get('attributes_inline'); + } + + // Get the array. + $attributes_inline = Json::decode($attributes_inline); + + // Get the array values and id in the keys. + $attributes_inline = array_values($attributes_inline); + + foreach ($attributes_inline as $attribute_inline) { + + $table .= ''; + $table .= ''; + $table .= ''; + + } + + $table .= ''; + $table .= '
' . $this->t('Attributes') . '
' . $attribute_inline . '
'; + + $markup = $table; + + $build = [ + '#markup' => $markup, + ]; + + return $build; + + } + /** * Handle Auto Complete. *