Same name and namespace in other branches
  1. 8.x-2.x src/Plugin/Field/FieldWidget/ExifHiddenWidget.php \Drupal\exif\Plugin\Field\FieldWidget\ExifHiddenWidget 1 comment

Plugin implementation of the 'exif_readonly' widget.

Plugin annotation


@FieldWidget(
  id = "exif_hidden",
  label = @Translation("metadata from image (hidden in forms)"),
  description = @Translation("field content is calculated from image field
  in the same content type (field are hidden from forms)"), multiple_values
  = true, field_types = {
    "string",
    "string_long",
    "text",
    "text_with_summary",
    "text_long",
    "entity_reference",
    "date",
    "datetime",
    "datestamp"
  }
)

Hierarchy

  • class \Drupal\exif\Plugin\Field\FieldWidget\ExifWidgetBase extends \Drupal\Core\Field\WidgetBase
    • class \Drupal\exif\Plugin\Field\FieldWidget\ExifFieldWidgetBase extends \Drupal\exif\Plugin\Field\FieldWidget\ExifWidgetBase
      • class \Drupal\exif\Plugin\Field\FieldWidget\ExifHiddenWidget extends \Drupal\exif\Plugin\Field\FieldWidget\ExifFieldWidgetBase

Expanded class hierarchy of ExifHiddenWidget

File

src/Plugin/Field/FieldWidget/ExifHiddenWidget.php, line 29

Namespace

Drupal\exif\Plugin\Field\FieldWidget
View source
class ExifHiddenWidget extends ExifFieldWidgetBase {
    
    /**
     * Implements callback of formElement.
     *
     * @param array $element
     *   A form element array containing basic properties for the widget.
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current state of the form.
     * @param array $form
     *   The form structure where widgets are being attached to.
     *
     * @return array
     *   The form elements for a single widget for this field.
     */
    public static function process(array $element, FormStateInterface $form_state, array $form) {
        $element['tid'] = [
            '#type' => 'hidden',
            '#value' => '',
        ];
        $element['value'] = [
            '#type' => 'hidden',
            '#value' => '',
        ];
        $element['timezone'] = [
            '#type' => 'hidden',
            '#value' => '',
        ];
        $element['value2'] = [
            '#type' => 'hidden',
            '#value' => '',
        ];
        $element['display'] = [
            '#type' => 'hidden',
            '#value' => '',
        ];
        return $element;
    }
    
    /**
     * {@inheritdoc}
     */
    public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
        $element += [
            '#type' => '#hidden',
            '#value' => '',
            '#process' => [
                [
                    get_class($this),
                    'process',
                ],
            ],
        ];
        return $element;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ExifFieldWidgetBase::defaultSettings public static function Overrides ExifWidgetBase::defaultSettings
ExifFieldWidgetBase::retrieveExifFieldDefaultSeparatorValue private function Get separator value from settings.
ExifFieldWidgetBase::retrieveExifFieldDefaultValue private function Get exif field name associated to this drupal field.
ExifFieldWidgetBase::retrieveExifFields private function List of possible fields.
ExifFieldWidgetBase::settingsForm public function Overrides ExifWidgetBase::settingsForm
ExifFieldWidgetBase::settingsSummary public function Overrides ExifWidgetBase::settingsSummary
ExifFieldWidgetBase::validateExifField public static function Ensure field is correctly configured.
ExifFieldWidgetBase::validateExifFieldSeparator public static function Ensure field separator is correctly configured.
ExifHiddenWidget::formElement public function
ExifHiddenWidget::process public static function Implements callback of formElement.
ExifWidgetBase::EXIF_BASE_DEFAULT_SETTINGS constant
ExifWidgetBase::retrieveImageFieldDefaultValue protected function Calculate default value for settings form.
ExifWidgetBase::retrieveImageFieldFromBundle protected function Retrieve list of image field labels by key of image field.
ExifWidgetBase::validateImageField public static function Validate field to ensure it is linked to a image field.