@@ -5,41 +5,41 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class CwpSiteSummaryExtension extends Extension |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Updates the modules used for the version label by: |
|
| 10 | - * - Removing SS Framework |
|
| 11 | - * - Adding CWP |
|
| 12 | - * - Relabelling SS CMS |
|
| 13 | - * |
|
| 14 | - * @param array $modules |
|
| 15 | - */ |
|
| 16 | - public function updateVersionModules(&$modules) |
|
| 17 | - { |
|
| 18 | - unset($modules['silverstripe/framework']); |
|
| 19 | - $modules = ['cwp/cwp' => 'CWP'] + $modules; |
|
| 20 | - $modules['silverstripe/cms'] = 'SilverStripe CMS'; |
|
| 21 | - } |
|
| 8 | + /** |
|
| 9 | + * Updates the modules used for the version label by: |
|
| 10 | + * - Removing SS Framework |
|
| 11 | + * - Adding CWP |
|
| 12 | + * - Relabelling SS CMS |
|
| 13 | + * |
|
| 14 | + * @param array $modules |
|
| 15 | + */ |
|
| 16 | + public function updateVersionModules(&$modules) |
|
| 17 | + { |
|
| 18 | + unset($modules['silverstripe/framework']); |
|
| 19 | + $modules = ['cwp/cwp' => 'CWP'] + $modules; |
|
| 20 | + $modules['silverstripe/cms'] = 'SilverStripe CMS'; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing |
|
| 25 | - * filter options) |
|
| 26 | - * |
|
| 27 | - * @param GridFieldDropdownFilter $dropdownFilter |
|
| 28 | - */ |
|
| 29 | - public function updateDropdownFilterOptions($dropdownFilter) |
|
| 30 | - { |
|
| 31 | - $dropdownFilter->removeFilterOption('supported'); |
|
| 32 | - $dropdownFilter->removeFilterOption('unsupported'); |
|
| 23 | + /** |
|
| 24 | + * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing |
|
| 25 | + * filter options) |
|
| 26 | + * |
|
| 27 | + * @param GridFieldDropdownFilter $dropdownFilter |
|
| 28 | + */ |
|
| 29 | + public function updateDropdownFilterOptions($dropdownFilter) |
|
| 30 | + { |
|
| 31 | + $dropdownFilter->removeFilterOption('supported'); |
|
| 32 | + $dropdownFilter->removeFilterOption('unsupported'); |
|
| 33 | 33 | |
| 34 | - $dropdownFilter->addFilterOption( |
|
| 35 | - 'supported', |
|
| 36 | - _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'), |
|
| 37 | - ['Supported' => true] |
|
| 38 | - ); |
|
| 39 | - $dropdownFilter->addFilterOption( |
|
| 40 | - 'unsupported', |
|
| 41 | - _t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'), |
|
| 42 | - ['Supported' => false] |
|
| 43 | - ); |
|
| 44 | - } |
|
| 34 | + $dropdownFilter->addFilterOption( |
|
| 35 | + 'supported', |
|
| 36 | + _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'), |
|
| 37 | + ['Supported' => true] |
|
| 38 | + ); |
|
| 39 | + $dropdownFilter->addFilterOption( |
|
| 40 | + 'unsupported', |
|
| 41 | + _t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'), |
|
| 42 | + ['Supported' => false] |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -13,48 +13,48 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class MaintenanceProxyExtension extends Extension |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Configures required environment settings for Composer's use, applies to |
|
| 18 | - * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in |
|
| 19 | - * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer |
|
| 20 | - * is created |
|
| 21 | - */ |
|
| 22 | - public function onAfterBuild() |
|
| 23 | - { |
|
| 24 | - // Provide access for Composer's StreamContextFactory, since it creates its own stream context |
|
| 25 | - if ($proxy = $this->getCwpProxy()) { |
|
| 26 | - $_SERVER['CGI_HTTP_PROXY'] = $proxy; |
|
| 27 | - } |
|
| 28 | - } |
|
| 16 | + /** |
|
| 17 | + * Configures required environment settings for Composer's use, applies to |
|
| 18 | + * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in |
|
| 19 | + * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer |
|
| 20 | + * is created |
|
| 21 | + */ |
|
| 22 | + public function onAfterBuild() |
|
| 23 | + { |
|
| 24 | + // Provide access for Composer's StreamContextFactory, since it creates its own stream context |
|
| 25 | + if ($proxy = $this->getCwpProxy()) { |
|
| 26 | + $_SERVER['CGI_HTTP_PROXY'] = $proxy; |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in |
|
| 32 | - * their Guzzle clients |
|
| 33 | - * |
|
| 34 | - * @param array $options |
|
| 35 | - */ |
|
| 36 | - public function updateClientOptions(&$options) |
|
| 37 | - { |
|
| 38 | - if ($proxy = $this->getCwpProxy()) { |
|
| 39 | - $options['proxy'] = $proxy; |
|
| 40 | - } |
|
| 41 | - } |
|
| 30 | + /** |
|
| 31 | + * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in |
|
| 32 | + * their Guzzle clients |
|
| 33 | + * |
|
| 34 | + * @param array $options |
|
| 35 | + */ |
|
| 36 | + public function updateClientOptions(&$options) |
|
| 37 | + { |
|
| 38 | + if ($proxy = $this->getCwpProxy()) { |
|
| 39 | + $options['proxy'] = $proxy; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234` |
|
| 45 | - * |
|
| 46 | - * @return string |
|
| 47 | - */ |
|
| 48 | - protected function getCwpProxy() |
|
| 49 | - { |
|
| 50 | - if (!Environment::getEnv('SS_OUTBOUND_PROXY') || !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')) { |
|
| 51 | - return ''; |
|
| 52 | - } |
|
| 43 | + /** |
|
| 44 | + * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234` |
|
| 45 | + * |
|
| 46 | + * @return string |
|
| 47 | + */ |
|
| 48 | + protected function getCwpProxy() |
|
| 49 | + { |
|
| 50 | + if (!Environment::getEnv('SS_OUTBOUND_PROXY') || !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')) { |
|
| 51 | + return ''; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - return sprintf( |
|
| 55 | - 'tcp://%s:%d', |
|
| 56 | - Environment::getEnv('SS_OUTBOUND_PROXY'), |
|
| 57 | - Environment::getEnv('SS_OUTBOUND_PROXY_PORT') |
|
| 58 | - ); |
|
| 59 | - } |
|
| 54 | + return sprintf( |
|
| 55 | + 'tcp://%s:%d', |
|
| 56 | + Environment::getEnv('SS_OUTBOUND_PROXY'), |
|
| 57 | + Environment::getEnv('SS_OUTBOUND_PROXY_PORT') |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -9,59 +9,59 @@ |
||
| 9 | 9 | |
| 10 | 10 | class NewsPage extends DatedUpdatePage |
| 11 | 11 | { |
| 12 | - private static $description = 'Describes an item of news'; |
|
| 12 | + private static $description = 'Describes an item of news'; |
|
| 13 | 13 | |
| 14 | - private static $default_parent = 'NewsHolderPage'; |
|
| 14 | + private static $default_parent = 'NewsHolderPage'; |
|
| 15 | 15 | |
| 16 | - private static $can_be_root = false; |
|
| 16 | + private static $can_be_root = false; |
|
| 17 | 17 | |
| 18 | - private static $icon = 'cwp/cwp:images/icons/sitetree_images/news.png'; |
|
| 18 | + private static $icon = 'cwp/cwp:images/icons/sitetree_images/news.png'; |
|
| 19 | 19 | |
| 20 | - private static $singular_name = 'News Page'; |
|
| 20 | + private static $singular_name = 'News Page'; |
|
| 21 | 21 | |
| 22 | - private static $plural_name = 'News Pages'; |
|
| 22 | + private static $plural_name = 'News Pages'; |
|
| 23 | 23 | |
| 24 | - private static $db = [ |
|
| 25 | - 'Author' => 'Varchar(255)', |
|
| 26 | - ]; |
|
| 24 | + private static $db = [ |
|
| 25 | + 'Author' => 'Varchar(255)', |
|
| 26 | + ]; |
|
| 27 | 27 | |
| 28 | - private static $has_one = [ |
|
| 29 | - 'FeaturedImage' => Image::class, |
|
| 30 | - ]; |
|
| 28 | + private static $has_one = [ |
|
| 29 | + 'FeaturedImage' => Image::class, |
|
| 30 | + ]; |
|
| 31 | 31 | |
| 32 | - private static $owns = [ |
|
| 33 | - 'FeaturedImage', |
|
| 34 | - ]; |
|
| 32 | + private static $owns = [ |
|
| 33 | + 'FeaturedImage', |
|
| 34 | + ]; |
|
| 35 | 35 | |
| 36 | - private static $table_name = 'NewsPage'; |
|
| 36 | + private static $table_name = 'NewsPage'; |
|
| 37 | 37 | |
| 38 | - public function fieldLabels($includerelations = true) |
|
| 39 | - { |
|
| 40 | - $labels = parent::fieldLabels($includerelations); |
|
| 41 | - $labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author'); |
|
| 42 | - $labels['FeaturedImageID'] = _t( |
|
| 43 | - 'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel', |
|
| 44 | - 'Featured Image' |
|
| 45 | - ); |
|
| 38 | + public function fieldLabels($includerelations = true) |
|
| 39 | + { |
|
| 40 | + $labels = parent::fieldLabels($includerelations); |
|
| 41 | + $labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author'); |
|
| 42 | + $labels['FeaturedImageID'] = _t( |
|
| 43 | + 'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel', |
|
| 44 | + 'Featured Image' |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | - return $labels; |
|
| 48 | - } |
|
| 47 | + return $labels; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function getCMSFields() |
|
| 51 | - { |
|
| 52 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 53 | - $fields->addFieldToTab( |
|
| 54 | - 'Root.Main', |
|
| 55 | - TextField::create('Author', $this->fieldLabel('Author')), |
|
| 56 | - 'Abstract' |
|
| 57 | - ); |
|
| 50 | + public function getCMSFields() |
|
| 51 | + { |
|
| 52 | + $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 53 | + $fields->addFieldToTab( |
|
| 54 | + 'Root.Main', |
|
| 55 | + TextField::create('Author', $this->fieldLabel('Author')), |
|
| 56 | + 'Abstract' |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - $fields->addFieldToTab( |
|
| 60 | - 'Root.Main', |
|
| 61 | - UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')), |
|
| 62 | - 'Abstract' |
|
| 63 | - ); |
|
| 64 | - }); |
|
| 65 | - return parent::getCMSFields(); |
|
| 66 | - } |
|
| 59 | + $fields->addFieldToTab( |
|
| 60 | + 'Root.Main', |
|
| 61 | + UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')), |
|
| 62 | + 'Abstract' |
|
| 63 | + ); |
|
| 64 | + }); |
|
| 65 | + return parent::getCMSFields(); |
|
| 66 | + } |
|
| 67 | 67 | } |