Example #1
0
 /**
  * Checks parameters requirements (required, min, max,...).
  * Updates default values of some parameters according the other parameters
  * values.
  * 
  * @throws UserError When a parameter fails its validate.
  */
 protected function validate()
 {
     parent::validate();
     // Checks parameters requirements (required, min, max,...).
     $faces = $this->faces->getValue();
     $stream = $this->stream->getValue();
     if ($faces && $stream) {
         $this->height->setDefaultValue(556);
     } elseif ($stream) {
         // && !$faces
         $this->height->setDefaultValue(395);
     } elseif ($faces) {
         // && !$stream
         $this->height->setDefaultValue(258);
     } else {
         // !$faces && !$stream
         $this->height->setDefaultValue(63);
     }
 }
Example #2
0
 /**
  * Checks parameters requirements (required, min, max,...).
  * Updates default values of some parameters according the other parameters
  * values.
  * 
  * @throws UserError When a parameter fails its validate.
  */
 protected function validate()
 {
     // 100 - 180
     // set default url (default parameter is url)
     $this->target->setDefaultValue($this->parser->getTitle()->getCanonicalUrl());
     if ($this->target->getParameter()->getName() == 'url') {
         if ($this->annotation->getOutput() == 'inline') {
             // displaying a +1 button inline
             // google documentation about width: min = 120, default (when unspecified) = 450
             $this->width->setMin(120);
         }
     } else {
         // $this->target->getParameter()->getName() = 'user'
         if (!$this->icon->getValue()) {
             // displaying a badge, not just an icon
             if ($this->size->getOutput() == 'small') {
                 $this->height_value = 69;
                 $this->width->setMin(170);
                 // google documentation
             } else {
                 $this->height_value = 131;
                 $this->width->setMin(100);
                 // google documentation
             }
         }
     }
     parent::validate();
 }
Example #3
0
 /**
  * Checks parameters requirements (required, min, max,...).
  * Updates default values of some parameters according the other parameters
  * values.
  * 
  * @throws UserError When a parameter fails its validate.
  */
 protected function validate()
 {
     parent::validate();
     if ($this->size->getOutput() == 's') {
         $this->count->setDefaultValue(9);
     }
 }
Example #4
0
 /**
  * Checks parameters requirements (required, min, max,...).
  * Updates default values of some parameters according the other parameters
  * values.
  * 
  * @throws UserError When a parameter fails its validate.
  */
 protected function validate()
 {
     parent::validate();
     if ($this->source->getParameter()->getName() == 'track') {
         $this->height->setDefaultValue(166);
     }
 }