Skip to content

Commit

Permalink
[TASK] Created check field in page properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Haeser committed Oct 3, 2019
1 parent ece2010 commit ede5bc8
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 4 deletions.
27 changes: 27 additions & 0 deletions Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

$llPrefix = 'LLL:EXT:page_speed_insights/Resources/Private/Language/locallang_tca.xlf:';

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'pages',
[
'tx_pagespeedinsights_check' => [
'label' => $llPrefix . 'pages.tx_pagespeedinsights_check',
'exclude' => true,
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle'
]
],
]
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'
--div--;PageSpeed Insights, tx_pagespeedinsights_check',
'',
'after: lastUpdated'
);
73 changes: 73 additions & 0 deletions Configuration/TCA/tx_pagespeedinsights_results.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
$llPrefix = 'LLL:EXT:page_speed_insights/Resources/Private/Language/locallang_tca.xlf:';

return [
'ctrl' => [
'title' => $llPrefix . 'tx_pagespeedinsights_results.title',
'label' => 'date',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid',
'sortby' => 'tstamp desc',
'iconfile' => 'EXT:page_speed_insights/Resources/Public/Icons/Extension.png',
'delete' => 'deleted',
'versioningWS' => true,
],
'columns' => [
'date' => [
'exclude' => true,
'label' => $llPrefix . 'tx_pagespeedinsights_results.date',
'config' => [
'type' => 'input',
'eval' => 'trim'
]
],
'mobile_score_performance' => [
'exclude' => true,
'label' => $llPrefix . 'tx_pagespeedinsights_results.mobile_score_performance',
'config' => [
'type' => 'input',
'eval' => 'trim'
]
],
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0]
],
'default' => 0,
'fieldWizard' => [
'selectIcons' => [
'disabled' => false,
],
],
]
],
],
'palettes' => [
'general' => [
'showitem' => 'date'
],
'mobile' => [
'showitem' => 'mobile_score_performance'
],
],
'types' => [
'0' => [
'showitem' => '
--div--;Results,
--palette;;general,
--palette;;mobile,
--div--;Visibility, sys_language_uid,
'
]
],
];
20 changes: 20 additions & 0 deletions Resources/Private/Language/locallang_tca.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2014-05-02T12:00:00Z">
<header/>
<body>
<trans-unit id="pages.tx_pagespeedinsights_check">
<source>Check on PageSpeed Insights</source>
</trans-unit>
<trans-unit id="tx_pagespeedinsights_results.title">
<source>PageSpeed Insights result</source>
</trans-unit>
<trans-unit id="tx_pagespeedinsights_results.date">
<source>Date</source>
</trans-unit>
<trans-unit id="tx_pagespeedinsights_results.mobile_score_performance">
<source>Mobile performance score</source>
</trans-unit>
</body>
</file>
</xliff>
Binary file added Resources/Public/Icons/Extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "haassie/page-speed-insights",
"type": "typo3-cms-extension",
"description": "Dashboard for TYPO3.",
"homepage": "https://typo3.org",
"description": "PageSpeed Insights extension for TYPO3",
"homepage": "https://www.richardhaeser.com",
"license": [
"GPL-2.0-or-later"
],
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$EM_CONF[$_EXTKEY] = [
'title' => 'Page Speed Insights',
'description' => 'Page Speed Insights',
'title' => 'PageSpeed Insights',
'description' => 'PageSpeed Insights',
'category' => 'fe',
'author' => 'Richard Haeser',
'author_email' => '[email protected]',
Expand Down
3 changes: 3 additions & 0 deletions ext_tables.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_pagespeedinsights_results');
12 changes: 12 additions & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Table structure for table 'pages'
#
CREATE TABLE pages
(
tx_pagespeedinsights_check tinyint(4) DEFAULT '0' NOT NULL
);

CREATE TABLE tx_pagespeedinsights_results
(
mobile_score_performance tinyint(4) DEFAULT '0' NOT NULL
);

0 comments on commit ede5bc8

Please sign in to comment.