Skip to content

Commit

Permalink
Merge pull request #5 from clickpress/feature-formgrid
Browse files Browse the repository at this point in the history
Add Feature formgrid
  • Loading branch information
stefansl authored Mar 15, 2021
2 parents d45a59e + 0d6b7fc commit 9146d60
Show file tree
Hide file tree
Showing 15 changed files with 471 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/Element/GridColumnStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

namespace Clickpress\ContaoClickpressGridBundle\Element;

use Psr\Log\LogLevel;
use Contao\CoreBundle\Monolog\ContaoContext;

/**
* Column start content element
* Taken with friendly permission from RockSolid Columns.
Expand Down
2 changes: 1 addition & 1 deletion src/Element/GridStop.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function generate()
if (!$GLOBALS['TL_CP_GRID'][$parentKey]['active']) {
trigger_error(
'Missing column stop element before column wrapper stop element ID ' . $this->id . '.',
E_USER_WARNING
\E_USER_WARNING
);
}
unset($GLOBALS['TL_CP_GRID'][$parentKey]);
Expand Down
67 changes: 67 additions & 0 deletions src/Forms/FormGridColumnStart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

/*
* This file is part of Contao Clickpress Grid.
*
* (c) Stefan Schulz-Lauterbach (https://clickpress.de)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Clickpress\ContaoClickpressGridBundle\Forms;

use Contao\Widget;

/**
* Column start content element
* Taken with friendly permission from RockSolid Columns.
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
*/
class FormGridColumnStart extends Widget
{
/**
* @var string Template
*/
protected $strTemplate = 'form_grid_column_start';

/**
* Do not validate.
*/
public function validate(): void
{
}

/**
* Parse the template file and return it as string.
*
* @param array $arrAttributes An optional attributes array
*
* @return string The template markup
*/
public function parse($arrAttributes = null): string
{
if (TL_MODE === 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');

return $objTemplate->parse();
}

return parent::parse($arrAttributes);
}

/**
* Generate the widget and return it as string.
*
* @return string The widget markup
*/
public function generate(): string
{
return '';
}
}
67 changes: 67 additions & 0 deletions src/Forms/FormGridColumnStop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

/*
* This file is part of Contao Clickpress Grid.
*
* (c) Stefan Schulz-Lauterbach (https://clickpress.de)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Clickpress\ContaoClickpressGridBundle\Forms;

use Contao\Widget;

/**
* Column stop content element
* Taken with friendly permission from RockSolid Columns.
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
*/
class FormGridColumnStop extends Widget
{
/**
* @var string Template
*/
protected $strTemplate = 'form_grid_column_stop';

/**
* Do not validate.
*/
public function validate() :void
{
}

/**
* Parse the template file and return it as string.
*
* @param array $arrAttributes An optional attributes array
*
* @return string The template markup
*/
public function parse($arrAttributes = null) :string
{
if (TL_MODE === 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');

return $objTemplate->parse();
}

return parent::parse($arrAttributes);
}

/**
* Generate the widget and return it as string.
*
* @return string The widget markup
*/
public function generate(): string
{
return '';
}
}
73 changes: 73 additions & 0 deletions src/Forms/FormGridStart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

declare(strict_types=1);

/*
* This file is part of Contao Clickpress Grid.
*
* (c) Stefan Schulz-Lauterbach (https://clickpress.de)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Clickpress\ContaoClickpressGridBundle\Forms;

use Contao\Widget;

/**
* Grid start content element
* Taken with friendly permission from RockSolid Columns.
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
*/
class FormGridStart extends Widget
{
/**
* @var string Template
*/
protected $strTemplate = 'form_grid_start';

/**
* Do not validate.
*/
public function validate() :void
{
}

/**
* Parse the template file and return it as string.
*
* @param array $arrAttributes An optional attributes array
*
* @return string The template markup
*/
public function parse($arrAttributes = null) :string
{
if (TL_MODE === 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');

return $objTemplate->parse();
}
$gridClasses = [
preg_replace('/grid/', 'grid_desktop', $this->form_cp_grid_desktop),
preg_replace('/grid/', 'grid_tablet', $this->form_cp_grid_tablet),
preg_replace('/grid/', 'grid_mobile', $this->form_cp_grid_mobile),
];
$arrAttributes['gridClasses'] = implode(' ', $gridClasses);

return parent::parse($arrAttributes);
}

/**
* Generate the widget and return it as string.
*
* @return string The widget markup
*/
public function generate(): string
{
return '';
}
}
67 changes: 67 additions & 0 deletions src/Forms/FormGridStop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

/*
* This file is part of Contao Clickpress Grid.
*
* (c) Stefan Schulz-Lauterbach (https://clickpress.de)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Clickpress\ContaoClickpressGridBundle\Forms;

use Contao\Widget;

/**
* Grid stop content element
* Taken with friendly permission from RockSolid Columns.
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
*/
class FormGridStop extends Widget
{
/**
* @var string Template
*/
protected $strTemplate = 'form_grid_stop';

/**
* Do not validate.
*/
public function validate()
{
}

/**
* Parse the template file and return it as string.
*
* @param array $arrAttributes An optional attributes array
*
* @return string The template markup
*/
public function parse($arrAttributes = null): string
{
if (TL_MODE === 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');

return $objTemplate->parse();
}

return parent::parse($arrAttributes);
}

/**
* Generate the widget and return it as string.
*
* @return string The widget markup
*/
public function generate(): string
{
return '';
}
}
6 changes: 6 additions & 0 deletions src/Resources/contao/config/config.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
*/

$GLOBALS['TL_CTE']['cp_grid']['cp_grid_start'] = 'Clickpress\\ContaoClickpressGridBundle\\Element\\GridStart';
Expand All @@ -25,3 +26,8 @@
$GLOBALS['TL_WRAPPERS']['stop'][] = 'cp_grid_stop';
$GLOBALS['TL_WRAPPERS']['start'][] = 'cp_column_start';
$GLOBALS['TL_WRAPPERS']['stop'][] = 'cp_column_stop';

$GLOBALS['TL_FFL']['cp_grid_start'] = 'Clickpress\\ContaoClickpressGridBundle\\Forms\\FormGridStart';
$GLOBALS['TL_FFL']['cp_grid_stop'] = 'Clickpress\\ContaoClickpressGridBundle\\Forms\\FormGridStop';
$GLOBALS['TL_FFL']['cp_column_start'] = 'Clickpress\\ContaoClickpressGridBundle\\Forms\\FormGridColumnStart';
$GLOBALS['TL_FFL']['cp_column_stop'] = 'Clickpress\\ContaoClickpressGridBundle\\Forms\\FormGridColumnStop';
Loading

0 comments on commit 9146d60

Please sign in to comment.