Expected Behavior
Fieldtype Matrix outputs rows defined by code and columns defined by a selector.
Actual Behavior
Fieldtype Matrix outputs an error saying one needs to use a Page Field or selectors. Screenshots can be attached of my own config to show how I reproduced this.
Steps to reproduce
- Set up a Matrix field with Code for row and Selector for column. Or the other way around. Just make sure it's not both Code nor both Selector.
- Use the field in a template.
- Try editing a page with that template.
Note:: It's easiest to reproduce this error when testing a $pages->find() query in the PHP code and comparing it to the selector output for the same row or column definition. $pages->find() is more useful in cases where rows or columns is defined by a Page Reference field on the page.
Where in the code does this need fixing?
https://github.com/kongondo/FieldtypeMatrix/blob/master/InputfieldMatrix.module#L301
if((!$parentRowColumnPageField) && (!$rowFindPagesCode || !$columnFindPagesCode) && (!$rowSelector || !$columnSelector))
In the above example case, the conditional evaluates to (true) && (false || true) && (false || true) == true.
Suggested Fix
if((!$parentRowColumnPageField) && (!$rowFindPagesCode && !$rowSelector) && (!$columnFindPagesCode && !$columnSelector))
In the above example case, the conditional evaluates to (true) && (false && true) && (false && true) == false. Which is what should be expected when using an asymmetric setup.