X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Ffontyourface%2Fsrc%2FPlugin%2Fviews%2Ffilter%2FFontYourFaceWeightFilter.php;fp=web%2Fmodules%2Fcontrib%2Ffontyourface%2Fsrc%2FPlugin%2Fviews%2Ffilter%2FFontYourFaceWeightFilter.php;h=2e956396194de334697d796efff708bf8c6a9ca1;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/fontyourface/src/Plugin/views/filter/FontYourFaceWeightFilter.php b/web/modules/contrib/fontyourface/src/Plugin/views/filter/FontYourFaceWeightFilter.php new file mode 100644 index 000000000..2e9563961 --- /dev/null +++ b/web/modules/contrib/fontyourface/src/Plugin/views/filter/FontYourFaceWeightFilter.php @@ -0,0 +1,72 @@ + [ + 'title' => $this->t('Is equal to'), + 'short' => $this->t('='), + 'method' => 'opEqual', + 'values' => 1, + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function valueForm(&$form, FormStateInterface $form_state) { + $options = [ + 'All' => '- Any -', + '100' => $this->t('100'), + '200' => $this->t('200'), + '300' => $this->t('300'), + '400' => $this->t('400 (Normal)'), + '500' => $this->t('500'), + '600' => $this->t('600'), + '700' => $this->t('700 (Bold)'), + '800' => $this->t('800'), + '900' => $this->t('900'), + ]; + + $form['value'] = [ + '#type' => 'select', + '#title' => $this->t('Font Weight'), + '#options' => $options, + '#default_value' => $this->value, + ]; + + if ($exposed = $form_state->get('exposed')) { + $identifier = $this->options['expose']['identifier']; + $user_input = $form_state->getUserInput(); + if (!isset($user_input[$identifier])) { + $user_input[$identifier] = $this->value; + $form_state->setUserInput($user_input); + } + } + } + +}