mrjmd / pdb

Decoupled Blocks is a Drupal 8 module to simplify integrating javascript frameworks into your site.
https://www.drupal.org/sandbox/mrjmd/2664138
57 stars 14 forks source link

pdb_ng2_component_info_alter() Undefined index: path #70

Closed kenneth-bolivar-castro closed 6 years ago

kenneth-bolivar-castro commented 8 years ago

I installed last version I found a couple of issues, first one is related with undefined index: pdb_ng2_component_info_alter

I noticed that "hook_component_info_alter" implementation within "pdb_ng2" module, it check "ng2" presentation components in order to define path, but it applies an "else" statement to check any others components, and it throws this warning message. if--ng2

We should remove "else" statement, and if we need to define path to any other component, we should implement "hook_component_info_alter" into correct module.

mrjmd commented 8 years ago

I don't think this is the best approach, because I want individual components to be able to define where their main component path is in their info file without having to write any PHP. So using hook_component_info_alter() is not desirable.

I'd prefer to see a solution to the bug that still allows the component's .info.yml file to define its own path to the component.

kenneth-bolivar-castro commented 8 years ago

@mrjmd I see what you mean, then we should define extension based on development mode neither default component path or hard-coded from YAML info file, https://github.com/mrjmd/pdb/pull/80/commits/332afb7339732a699e44f64fd3095ebfb4e7e2fb#diff-6c5ac3a9b9491d4f4c37dc746b4a4a21R28

It means, we could setup path pair value within YAML info file like this,

name: NG2 Example
machine_name: ng2-example-1
type: pdb
description: 'NG 2 Example Component 1'
package: NG2
version: '1.0.0'
core: '8.x'
module_status: active
presentation: ng2
path: modules/contrib/pdb/modules/pdb_ng2/components/ng2_example_1/component

Then no matter what settings we had selected it will load proper file, even if we hard-coded path.