Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formfield layouts #22645

Merged
merged 6 commits into from Feb 26, 2019

Conversation

Projects
None yet
10 participants
@phproberto
Copy link
Contributor

phproberto commented Oct 15, 2018

Summary of Changes

This is a resubmission of #13018 because I totally abandoned @Spudley which is the worst I could do with a new contributor :( I'm really sorry mate and I hope you get your contribution merged at least 2 years later. I created a custom email rule for the repo notifications and everything is messed there.

This pull request adds the default layout paths to FormField::getLayoutPaths() so developers can inherit them and add any custom layout path required by their extensions.

Before this patch a developer wanting to set custom layout paths had to do something like:

	protected function getLayoutPaths()
	{
		$renderer = new FileLayout('default');

		return array_merge(
		    array(__DIR__ . '/custom-dir'), 
		    $renderer->getDefaultIncludePaths())
	}

After this patch it should be easier like:

	protected function getLayoutPaths()
	{
		return array_merge(
			[__DIR__ . '/custom-dir'],
			parent::getLayoutPaths()
		);
	}

which should be better because:

  • Parent cares about default include paths.
  • Child classes do not have to explicitly create an instance of FileLayout

This also adds unit tests for FormField::getLayoutPaths().

Testing Instructions

Edit any form containing fields (for instance com_content article) and ensure that form fields are shown correctly.

If you want ot test layout paths customisation you can create a field like it's done in the tests:

https://github.com/phproberto/joomla-cms/blob/formfield-layouts/tests/unit/suites/libraries/joomla/form/_testfields/customlayouts.php

@zero-24 zero-24 added this to the Joomla 3.9.4 milestone Feb 19, 2019

@chmst

This comment has been minimized.

Copy link
Contributor

chmst commented Feb 19, 2019

I have tested this item successfully on 683cd61

Tested following the testing instructions, on a localhost, xampp, win10, and the testfield.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22645.

@zero-24

This comment has been minimized.

Copy link
Contributor

zero-24 commented Feb 26, 2019

I have tested this item successfully on 4b6c9fc

Working as intended leaving this to @HLeithner for an merge.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22645.

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 3.9.4 milestone Feb 26, 2019

@Quy

This comment has been minimized.

Copy link
Contributor

Quy commented Feb 26, 2019

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22645.

@joomla-cms-bot joomla-cms-bot added the RTC label Feb 26, 2019

@zero-24 zero-24 added this to the Joomla 3.9.4 milestone Feb 26, 2019

@HLeithner HLeithner merged commit 1ae453b into joomla:staging Feb 26, 2019

4 checks passed

JTracker/HumanTestResults Human Test Results: 2 Successful 0 Failed.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/drone/pr the build was successful
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@HLeithner

This comment has been minimized.

Copy link
Member

HLeithner commented Feb 26, 2019

thx

@joomla-cms-bot joomla-cms-bot removed the RTC label Feb 26, 2019

@Spudley

This comment has been minimized.

Copy link
Contributor

Spudley commented Feb 26, 2019

thank you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.