You are here

protected function BlazyAdminBase::showAltTitleFieldHint in Blazy 7

If the image field doesn't have the Title field enabled, tell the user.

2 calls to BlazyAdminBase::showAltTitleFieldHint()
BlazyAdminBase::mediaSwitchForm in src/Form/BlazyAdminBase.php
Returns re-usable media switch form elements.
BlazyAdminBase::openingForm in src/Form/BlazyAdminBase.php
Returns shared form elements across field formatter and Views.

File

src/Form/BlazyAdminBase.php, line 792

Class

BlazyAdminBase
A base for blazy admin integration to have re-usable methods in one place.

Namespace

Drupal\blazy\Form

Code

protected function showAltTitleFieldHint($definition) {
  $instance = empty($definition['instance']) ? FALSE : $definition['instance'];
  if ($instance && (isset($instance['settings']['title_field']) && $instance['settings']['title_field'] == FALSE || isset($instance['settings']['alt_field']) && $instance['settings']['alt_field'] == FALSE)) {
    $bundle_path = $this
      ->getBundlePath($instance);
    return t('You need to <a href="@url" target="_blank">enable both title and alt fields</a> to use them as caption.', [
      '@url' => url($bundle_path['field'], [
        'fragment' => 'edit-instance-settings-alt-field',
        'query' => [
          'destination' => $bundle_path['display'],
        ],
      ]),
    ]);
  }
  return FALSE;
}