File tree Expand file tree Collapse file tree
modules/custom/icrp_custom_conditions/src/Plugin/Condition Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Drupal \icrp_custom_conditions \Plugin \Condition ;
44
5- use Drupal \rules \ Core \RulesConditionBase ;
5+ use Drupal \Core \Condition \ ConditionPluginBase ;
66
77/**
8- * Provides a 'Data comparison ' condition.
8+ * Provides a 'Has No Redirect ' condition.
99 *
1010 * @Condition(
1111 * id = "icrp_has_no_redirect",
1212 * label = @Translation("Has No Redirect"),
1313 * category = @Translation("ICRP")
1414 * )
15- *
16- * @todo: Add access callback information from Drupal 7.
17- * @todo: Find a way to port rules_condition_data_is_operator_options() from Drupal 7.
1815 */
19- class HasNoRedirect extends RulesConditionBase {
16+ class HasNoRedirect extends ConditionPluginBase {
2017
2118 /**
22- * Check for Redirect .
19+ * Evaluates the condition .
2320 *
2421 * @return bool
25- * Return true if the 'destination' query parameter exists.
22+ * TRUE when there is no destination query parameter.
23+ */
24+ public function evaluate () {
25+ return !\Drupal::request ()->query ->has ('destination ' );
26+ }
27+
28+ /**
29+ * Summary shown in block UI.
2630 */
27- protected function doEvaluate () {
28- return !\Drupal:: request ()-> query -> has ( ' destination ' );
31+ public function summary () {
32+ return $ this -> t ( ' Checks whether the destination query parameter is absent. ' );
2933 }
34+
3035}
You can’t perform that action at this time.
0 commit comments