{% set base_url = url('
image is variable
set is used to update value in variable
{% %}is used to write twing code
core/modules/views/templates/views-view-unformatted.html.twig Functions and templates for the user interface that themes can override. {#
/**
* @file
* Default theme implementation for unformatted summary links.
*
* Available variables:
* - rows: The rows contained in this view.
* - url: The URL to this row's content.
* - count: The number of items this summary item represents.
* - separator: A separator between each row.
* - row_classes: HTML attributes for a row, either containing an 'active' class
* or no attributes, that correlate to each row by ID.
* - options: Flags indicating how each row should be displayed. This contains:
* - count: A flag indicating whether the row's 'count' should be displayed.
* - inline: A flag indicating whether the item should be wrapped in an inline
* or block level HTML element.
*
* @see template_preprocess()
* @see template_preprocess_views_view_summary_unformatted()
*
* @ingroup themeable
*/
#}
{% for id, row in rows %}
{{ options.inline ? '
{% if row.separator -%}
{{ row.separator }}
{%- endif %}
{{ row.link }}
{% if options.count %}
({{ row.count }})
{% endif %}
{{ options.inline ? '' : '' }}
{% endfor %} Default theme implementation for unformatted summary links.
Available variables:
rows: The rows contained in this view.
url: The URL to this row's content.
count: The number of items this summary item represents.
separator: A separator between each row.
row_classes: HTML attributes for a row, either containing an 'active' class or no attributes, that correlate to each row by ID.
options: Flags indicating how each row should be displayed. This contains:
count: A flag indicating whether the row's 'count' should be displayed.
inline: A flag indicating whether the item should be wrapped in an inline or block level HTML element. setting value of field "machine name -field_featured_image " in image variable
{% set image = row.content['#view'].style_plugin.render_tokens[ loop.index0 ]['{{ field_featured_image }}'] %}
unformatted twig file apply for all entries made by views https://www.specbee.com/blogs/twig-tweak-in-drupal-9-functions-and-filters
Best practices include having one class or interface or trait per file. That file should be named for the class, such that the file name for FooInterface would be FooInterface.php.
$form['candidate_mail'] = array(
'#type' => 'email',
'#title' => t('Email ID:'),
'#required' => TRUE,
);
Returns the submitted form value for a specific key.
it is the key which is defined in form array
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
if (strlen($form_state->getValue('candidate_number')) < 10) {
$form_state->setErrorByName('candidate_number', $this->t('Mobile number is too short.'));
$form['candidate_mail'] = array(
'#type' => 'email',
'#title' => t('Email ID:'),
'#required' => TRUE,
);
Returns the submitted form value for a specific key.
it is the key which is defined in form array
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
if (strlen($form_state->getValue('candidate_number')) < 10) {
$form_state->setErrorByName('candidate_number', $this->t('Mobile number is too short.'));
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
foreach($age as $x => $val) {
echo "$x = $val
";
}
out put
Peter = 35
Ben = 37
Joe = 43
The property_exists() function is an inbuilt function in PHP that is used to check objects and classes have properties or not.
Syntax:
bool property_exists(object|string $object_or_class, string $property);
Parameters: This function accept two parameters that are described below:
$object_or_class: The name of the class or object to test for the property.
$property_name: This name of the property in the class.
Return Value: This function returns true if the property exists, and false if property doesn’t exist, and null in case of getting an error.
<\p>
class ko{
public $g='jjjjjjjjjj';
}
if (property_exists('ko','g')){
echo("jjjjjjjjjjjjj");
}
<\p>
$g_config = \Drupal::config('global_modules.admin_settings_form') var $main_config = []; var ka php me matlab hota hai public access modifier aur ye ek property hai
$this->main_config = [
'keyId' => $g_config->get('razorpay_keyid'),
'keySecret' => $g_config->get('razorpay_keysecret'),
'domain' => $host,
'displayCurrency' => "INR"
]; \Symfony\Component\HttpFoundation\Request The currently active request object.
Drupal::request()
Drupal
Static Service Container wrapper.
Code
public static function request() {
return static::getContainer()
->get('request_stack')
->getCurrentRequest();
} str_replace('https://give.jkyog.org/fundraiser/','',$data[10]);
parameter 1 -> string which will get replaced ,
parameter 2 -> string which which it will get replaced , in this case it is empty string
parameter 3 -> string in which search to be done . in this case $data[10] i.e https://give.jkyog.org/fundraiser/3753687
str_replace('https://give.jkyog.org/fundraiser/','',$data[10]);
parameter 1 -> string which will get replaced ,
parameter 2 -> string which which it will get replaced , in this case it is empty string
parameter 3 -> string in which search to be done . in this case $data[10] i.e https://give.jkyog.org/fundraiser/3753687
usort(array, callback)
Required. A comparison function. Must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument
function cmp($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
$a = array(3, 2, 5, 6, 1);
usort($a, "cmp");
foreach ($a as $key => $value) {
echo "$key: $value\n";
} update public.registrations set version_no=1 where version_no IS NULL; Yyy Uuuuii