Commit febbb95b authored by Milos Bovan's avatar Milos Bovan Committed by Damien McKenna
Browse files

Issue #3001387 by mbovan, Berdir, kell.mcnaughton, DamienMcKenna: Extend meta...

Issue #3001387 by mbovan, Berdir, kell.mcnaughton, DamienMcKenna: Extend meta tag definition to allow some tags to use a textarea instead of text field, e.g. og:description.
parent 031475f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx
  Revisit-After.
#3077772 by DamienMcKenna, thejimbirch, volkswagenchick, cindytwilliams: Add new
  meta tags: pragma, cache-control, expires.
#3001387 by mbovan, Berdir, kell.mcnaughton, DamienMcKenna: Extend meta tag
  definition to allow some tags to use a textarea instead of text field, e.g.
  og:description.


Metatag 8.x-1.10, 2019-08-29
+3 −2
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@ use Drupal\metatag\Plugin\metatag\Tag\MetaPropertyBase;
 *   weight = 6,
 *   type = "label",
 *   secure = FALSE,
 *   multiple = FALSE
 *   multiple = FALSE,
 *   long = TRUE,
 * )
 */
class OgDescription extends MetaPropertyBase {
  // Nothing here yet. Just a placeholder class for a plugin.

}
+7 −0
Original line number Diff line number Diff line
@@ -80,6 +80,13 @@ class MetatagTag extends Plugin {
   */
  public $multiple;

  /**
   * True if the tag should use a text area.
   *
   * @var bool
   */
  public $long;

  /**
   * True if the URL value(s) must be absolute.
   *
+2 −17
Original line number Diff line number Diff line
@@ -14,25 +14,10 @@ namespace Drupal\metatag\Plugin\metatag\Tag;
 *   weight = 3,
 *   type = "label",
 *   secure = FALSE,
 *   multiple = FALSE
 *   multiple = FALSE,
 *   long = TRUE,
 * )
 */
class AbstractTag extends MetaNameBase {

  /**
   * Generate a form element for this meta tag.
   */
  public function form(array $element = []) {
    $form = [
      '#type' => 'textarea',
      '#title' => $this->label(),
      '#default_value' => $this->value(),
      '#row' => 2,
      '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
      '#description' => $this->description(),
      '#element_validate' => [[get_class($this), 'validateTag']],
    ];
    return $form;
  }

}
+2 −17
Original line number Diff line number Diff line
@@ -14,25 +14,10 @@ namespace Drupal\metatag\Plugin\metatag\Tag;
 *   weight = 2,
 *   type = "label",
 *   secure = FALSE,
 *   multiple = FALSE
 *   multiple = FALSE,
 *   long = TRUE,
 * )
 */
class Description extends MetaNameBase {

  /**
   * Generate a form element for this meta tag.
   */
  public function form(array $element = []) {
    $form = [
      '#type' => 'textarea',
      '#title' => $this->label(),
      '#default_value' => $this->value(),
      '#row' => 2,
      '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
      '#description' => $this->description(),
      '#element_validate' => [[get_class($this), 'validateTag']],
    ];
    return $form;
  }

}
Loading