You are here

public function BlazyAdminExtended::closingForm in Blazy 8.2

Same name and namespace in other branches
  1. 8 src/Dejavu/BlazyAdminExtended.php \Drupal\blazy\Dejavu\BlazyAdminExtended::closingForm()

Returns shared ending form elements across field formatter and Views.

Overrides BlazyAdminBase::closingForm

File

src/Dejavu/BlazyAdminExtended.php, line 140

Class

BlazyAdminExtended
Provides re-usable admin functions, or form elements.

Namespace

Drupal\blazy\Dejavu

Code

public function closingForm(array &$form, $definition = []) {
  if (!empty($definition['caches'])) {
    $form['cache'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Cache'),
      '#options' => $this
        ->getCacheOptions(),
      '#weight' => 98,
      '#enforced' => TRUE,
      '#description' => $this
        ->t('Ditch all the logic to cached bare HTML. <ol><li><strong>Permanent</strong>: cached contents will persist (be displayed) till the next cron runs.</li><li><strong>Any number</strong>: expired by the selected expiration time, and fresh contents are fetched till the next cache rebuilt.</li></ol>A working cron job is required to clear stale cache. At any rate, cached contents will be refreshed regardless of the expiration time after the cron hits. <br />Leave it empty to disable caching.<br /><strong>Warning!</strong> Be sure no useless/ sensitive data such as Edit links as they are rendered as is regardless permissions. No permissions are changed, just ugly. Only enable it when all is done, otherwise cached options will be displayed while changing them.'),
    ];
    if (!empty($definition['_views'])) {
      $form['cache']['#description'] .= ' ' . $this
        ->t('Also disable Views cache (<strong>Advanced &gt; Caching</strong>) temporarily _only if trouble to see updated settings.');
    }
  }
  parent::closingForm($form, $definition);
}