texts:
How to make the image hover between the 2 uploaded image?

    <a href="<?php if (!empty($node->field_link_site)) print $node->field_link_site['und'][0]['value']; ?>" target="_blank">
        <?php print theme('image_style', array('path' => $imageone, 'style_name' => 'image_800x600', 'attributes'=>array('alt'=>$title))) ?>

The script above just make the node display one image.

The second image is not appearing.

How to make it the image change to the 2nd image if mouse move over the image?


texts: Create a view from both user and node content

texts:
Is it possible in Drupal 8 to create a view from both Users and other content? I need a page that shows photo's from Users and logo's from a content type 'Organisation'.

If I make a page view from content, it will not give the possibility to select data from 'Users', and vice versa.


texts:
I got a view, which lists nodes of same type, a "Other activities" view, i use this view on a activity node view. However i don't want the node i am currently viewing, to show in the list as well.

So what i did, was to make a contextual filter for nid, and provide a default value of "Content ID of URL", of course now my list only provides me with the currently viewing node.

Isn't there anyway to negate this? So it shows all other nodes, that don't have the nid, og the current?


texts: Get multiple results from entity reference relationship in views

texts:
In a view that displays content of a type that uses an Entity Reference (specifically User reference), I add that relationship but even though multiple users may be/are referenced by the content I only get one of them. Am I missing some sort of configuration?

In the relationship description: "A bridge to the User entity that is referenced via field_users"

EDIT: So after a private discussion with @Anil Sagar it seems that you cannot -using entityreference alone- display multiple results of the referenced entities in one row of the Entity the view displays.

The best you can get is:

Article One
body
image
user1 name
user1 surname

Article One
body
image
user2name
user2surname

(users 1 and 2 are referenced by Article One).


texts:
How do i get the base url in template.php?

None of the below works.

global $base_url;
global $base_path;
global $base_root;


texts: How can I change the user login tabs labels?

texts:
I am pretty new to Drupal and wonder if there's any possibility to change the text of the user login / create an account and reset tab? I'd like to rename them to something like "sign in", "sign up" and "reset account".
I found no way through the backend UI. Neither in Tabs Block Content nor Menu structure.
Do I need to write a theme hook or a module to achieve that, or is there any functionality in the backend I've overlooked?


texts: How do you add type-property schemas from Schema.org into 8 sites?

texts:
Some SEOers have reported good experience with enriching their websites with the formal schema vocabulary Schema.org.

Is there any way to implement such schemas on Drupal 8 webpages?

Update - July 9 2016:

Is it true to say to most of the functionality of this module got into the Drupal 8 core via the module Aggregator 8.x.x ? I read now in the modules' page (for Drupal 7 as linked in the answer) and that's what I understood; But if it did, then when why creating a new module is on the quine? It is written there the module has not yet been ported and that's why I'm confused.


texts: How do I send an email to users who have been inactive for 30 days with a condition

texts:
I used the answer in How can I send email to user that is not logged in since 30 days? to successfully set up an action set component that would email the user and a rule that would schedule that component delayed by 30 days. It's doing everything I want to except for one thing.

If the user has completed the course (course module) I don't want to nag them about being inactive. However, it doesn't look like I have access to that information when the action set gets evaluated.

The course module has some custom events and the information about course completion is exposed to rules via entities. If I create a rule triggered on the course_updated event I have access to the completion data I need (like this one https://www.drupal.org/node/2151827), but when the event is simply user login or it's triggered by the scheduler, I don't have access to that entity.

Do I need to add a custom condition or can I somehow query the course_report entity for the user who is scheduled?

Thanks!


texts: project/configuration sync from shell (not from ./admin)

texts:
With project/configuration (core 7.22 and configuration 7.x-2.0-alpha2), we can sync a new database to the exported .inc files via the admin gui, but need to be able to do it from drush.

Specifically, we trying to get to where we can run drush site-install, and then drush sync config, to get content types and other meta-data built, from the project/configuration exported .inc files.

It looks like the heavy lifting is implemented in configuration.module, function configuration_import_directory.  Do we still have to roll our own, to be able to invoke this from the shell?


texts: When should hook_post_update_NAME() be implemented instead of hook_update_N()?

texts:
What I found so far is that certain actions are unsafe to be performed inside hook_update_N(), but I didn't find any documentation saying which those actions are.

When should I implement hook_post_update_NAME() instead of hook_update_N()?


texts: How to set the values of some fields depending on the value of a list box?

texts:
Remember the create password page of Drupal! while you are entering characters it tells you how string is your password!

now I want to have something like this in a list box but a bit different. I want to show an image and a text depend on the item which is selected in the list box! How can I do it?

My first try was using conditional field but I have to add 120 image and text field to my content type and but lots of conditions to handle it. It doesn't make sense!

My second try was using markup module but I didn't know how to fetch the value of list box with ajax!

My third try was using entity referenced auto fill but when I select an item from the list box for the first time it fills the other fields correctly. but the next times it does not change any thing.

in addition, I need the image and text field to appear read only (non editable)

Do you know any other way to do that?


texts:
I create a simple ecard page where users can send some (stupid) ecard to other people.

Now for some reason our clients wants to save all these email addresses, and I'm wondering what the best way to do this is?
Obviously I would also need to show a list in the admin.

I was thinking of just using some newsletter module, but for none I checked there is a function where I can add email addresses using coding.

Does anybody know a quick and simple solution? I have custom coded this page, so I'm looking for a module that allows me to add email addresses in php.


texts: Nested select with Drupals DataBase interface

texts:
I have the following SQL query and need to translate it to the drupal API:

SELECT
  *,
  (SELECT COUNT(*)
    FROM newsletter
    WHERE email = pupils.email
  ) AS newsletter_flag
FROM
  memberdata.pupils
LEFT JOIN
  memberdata.pupil_profiles
ON
  memberdata.pupils.id = memberdata.pupil_profiles."pupils.id"
WHERE
  pupils.status != 'u'
ORDER BY
  pupils.timestamp DESC
LIMIT 10;

Background: There is a table with pupils (some basic info including mail adress) and a table newsletter containing the email addresses of pupils that registered for the newsletter. I need a list of all pupil with their fields and additionally the field newsletter_flag, indicating if the pupils email adress is in the newsletter table or not. Additionally I need a join to another table with primary foreign key. I've come this far:

$query = Database::getConnection('default', 'for_migration')
->select('memberdata.pupils', 'pupils')
->fields('pupils', array('id', 'firstname', 'lastname', 'birthday', 'gender'))
->condition('status', 'u', '!=')
->range(0, 10)
->orderBy('pupils.timestamp', 'DESC');

$alias = $query->leftjoin('newsletter', 'nl', 'pupils.email = nl.email');
$query->addExpression("COUNT($alias.email)", 'newsletter_flag');

But it does not what I want (the pupil_profiles join is still missing of course, but the newsletter flag is the bigger problem I guess). The source database is a PostgreSQL one and the query itself is part of a Migration subclass, in which a MigrateSourceSQL is used as source. Therefore the query needs to be a SelectQueryInterface.


texts:
I'd like to build a custom "Add more" link under each group by in a view. I'd also need the node ID of the group by field as a token.
Is this possible?


texts:
system.menus.css has it's own styles for the menu block. How can I override this style?

Would creating a folder called CSS in my theme and adding a file system.menus.css override it?


texts:
I'm trying to install Cart form ubercart after an uninstall:

I'm getting the following message what can I do?

  Unable to install Cart, image.style.uc_cart, uc_order.status.abandoned
  already exist in active configuration.


texts: Disabling the media browser private download option , showing public download as an option

texts: In the media module when we upload an image it asks us how to store a file (as public or private). But I don't want to show the user these options. Moreover, the user should not see that option box and the file uploaded should be saved as public file only. How can I implement this?


texts: Saving a default value when using entityMetaDataWrapper->save()

texts:
I have an entity that I import some data into, then create and save via entityMetadataWrapper->save().

When I looked on the form, it appeared that a default value that I set up for a field that I'm not importing was being saved, but later when I try to use that field, it's null in the code.  If I go to my entity and save it, then the default value is saved and all is right with the world.  Is there something special I need to do before save() to tell it to use my default value and actually save it?


texts: How can I programmatically populate a drop-down list field's options?

texts:
I have a paragraph bundle with several fields, on of them being drop-down list.

How would I go about populating this dropdown list via code, programmaticaly?

I don't really know where to begin with this...


texts: How are global roles synced with group roles?

texts:
How are global roles synced with group roles in the Drupal 8 group module?

I expect that the module would either:

Create a group roles in each group type for each global role

and/or one of the below:

Create role assignments for users in the group who have a global role that matches a group role name.
Assign global roles for users who have a group role in any group where the group role name matches a global role name.

In my testing so far it appears to do none of the above.

The group role sub-module is marked as deprecated and has a note that the functionality is in the core group module. A code review shows that the sub-module is basically empty. Therefore I take it the note is correct. I also see that the group module implements hook_rebuild and it creates a config entity for each global role.

None of the above expected results are happening however.


texts: How to get current route in the midst of a Views AJAX request

texts:
I need to conditionally pass contextual filter values to a view based on the current route and am attempting to do so in hook_views_pre_view. This is the result of using AJAX via views_infinite_scroll and losing the contextual filters that I initially pass in programmatically.
On the initial request, the following works great for getting the current route in hook_views_pre_view:
$current_route_match = \Drupal::getContainer()->get('current_route_match');
$current_route_match->getRouteName();

However, when I hit the 'Load more' button supplied by views_infinite_scroll, the route name of the current route match is 'views.ajax'. While I understand that this is technically the request's route, I need to know the original route, or from where the request was made.
After digging around, I noticed that $_SERVER['HTTP_REFERER'] had the right path, but the documentation says:

Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.


texts: Error When Create Drupal Commerce Product Display

texts:
I have managed to create a product type and import my product data, so I now have a list of products.
then i follow ryan szrama instruction http://drupalwatchdog.com/1/1/building-commerce-product-display

After that i get this error.
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 339 of C:\xampp\htdocs\drupal7\modules\entity\includes\entity.wrapper.inc).

what i should do??


texts: how to set up checkbox value while creating a node

texts:
Here is my code. I have a problem with while creating node. There are three checkboxes which user have to select; only the last checkbox of data (black color) is saved for node.

What is wrong with my code?

$node = new stdClass();
$node->type = 'product';
node_object_prepare($node);

$node->title    = $title;
$node->language = LANGUAGE_NONE;

$node->field_operator['und']['0']['tid'] = 135;// white color
$node->field_operator['und']['0']['tid'] = 136;// blue color
$node->field_operator['und']['0']['tid'] = 162;// black color

node_save($node);


texts: Select locale translation info from non-default database

texts:
I setup 2 databases connections in settings.php, one is MySQL on which Drupal is installed and running, the other is Oracle from which sometimes reading some info non-relevant to Drupal as below:

db_set_active('OracleDB');
db_query('...');
db_set_active();

I forgot to catch exceptions for line 2. It works as designed. But some day, the Oracle server was down, and resulted a 500 error in Drupal, so I guess the line 3 had not been executed. Now, even the Oracle server is up, whenever the 3 lines are executed, it generates errors in Apache error_log as below:

We can see Drupal query locale translated strings(in fact and other things i.e. menu info, etc) against the Oracle database!
I've tried methods as below:

Set the oracle-query-codes module'weight to 999 or -999 in database
and flush cache;
Diasble, uninstall and enable the
oracle-query-codes module;
Find & replace the Oracle connection
key(in settings.php) with 'default' or '' directly in Drupal MySQL
database.

None worked.

Now, my website can run normally, except those pages need the execution of the 3 lines code of Oracle query.

So how to get it back in the track?


texts: In which step in the checkout process is an user account is created?

texts:
I'm using Commerce Kickstart (Drupal 7.23, Kickstart 7.x-2.9). New commerce orders are linked to user accounts. If an account with the same email address does not exist yet, a new account is created. This is the normal flow.

I would like to know in which part of the checkout process, that account is created or linked to, because I've found some cases where the commerce order is linked to anonymous user with no reason.


texts:
There are several modules that send email from my site: Rules, Trigger, User, ...

I am looking for a place to set a drupal_set_message() and print out the email contents. Where in the code would be the best place for that?


texts: Google Rich Snippets and Facebook Open Metagraph

texts:
I want to implement support for Google Rich Snippets to show author info and fivestar ratings in Google's search engine results pages. I also want to be able to support Facebook's Open Graph to have Facebook pick the correct image when a node with an image is "liked" or embedded on Facebook.

Looks like I can use Schema.org, microdata or RDFx modules. I also came across a post suggesting to just use a preprocess hook.

The schema.org module doesn't seem to support fivestar ratings. Microdata is relatively new and I'm a bit confused about the RDFX module.

Does anyone have experience with this?


texts: Set value to Field collection item link field

texts:
I have a Field Collection item which consist of a drop down, a text box and a link field. After the user submits a form I create a node were this field collection item is included. Before I save it, I populate some fields.

I managed to set the 'Url' in the link field(part of field collection item) by using:

$field_collection_item2->field_url->setValue($base_url . '/form/email-project-completion-survey');

Which works fine. Now I'm trying to set the 'Link text' but I can't make it work.

Any idea?

Thank you in advance


texts: How to get node editing form in a custom module

texts:
how to call a drupal node editing form in a custom module? What i have done so far:

/*
 *  implementing hook_menu()
 */

function mymodule_menu() {
  $items = array();

  $items['custompage'] = array(
    'title' => t('Sometitle'),
    'page callback' => 'custom_page',
    'access callback' => 'user_access',
    'type' => MENU_NORMAL_ITEM
  );
  return $items;
}

function custom_page() {
  $output = '';
  $output = drupal_get_form(15);
  return $output;
}

But it won't output node edit form with nid 15. What i am doing wrong?


texts: Dependent multiple selection drop down in drupal form - illegal choice error

texts:
I'm new to Drupal , in my project I have 2 multiple select drop down box. I don't know how to do dependent multi select drop down action in drupal form alter function using ajax.

Single selection dependent drop down selection is working. But when i tried the same in case of 2 multi select dependent drop down i couldn't find any solution . On multi select error "An illegal choice has been detected. Please contact the site administrator." is shown.

Please help me how to use 2 multi select dependent drop down in drupal.

Here is my code : here "field_department" is the 1st multi select drop down. "field_policy_categories" is the 2nd muti select drop down. i want 2nd drop down values corresponding to 1st field's multi selected options.

function policy_node_form(){
$form['field_department'] = array(
    '#type' => 'select',
    '#title' => 'Department',
    '#multiple' => TRUE,
    '#options' => array(
        '' => t('-Select-'),
        '1444' => t('department1'),
        '1445' => t('department2'),
        '1446' => t('department3'),
        '1447' => t('department4'),
        '1448' => t('department5'),
        '1449' => t('department6')
        )
);
$form['field_policy_categories'] = array(
    '#type' => 'select',
    '#title' => 'Categories',
     '#multiple' => TRUE,
    '#options' => array()
);

}
function page_form_alter(&$form, &$form_state, $form_id) {

if ($form_id == 'policy_node_form') {
$category = array();
$category[''] = '- None -';

$form['field_department']['und']['#ajax'] = array(
    'wrapper' => 'policy_category_list',
    'callback' => 'ajax_policy_category_callback',
    'method' => 'replace',
);

$form['field_policy_categories']['#validated'] = TRUE;
$form['field_file_upload']['#validated'] = TRUE;

if (isset($form_state['values']['field_department'])) {

    $array_departments = array($form_state['values']['field_department']['und']['0']['tid']);

    $query = db_select('field_data_field_department', 'f');
    $query->join('taxonomy_term_data', 't', 'f.entity_id = t.tid');
    $query->join('taxonomy_term_hierarchy', 'h', 't.tid = h.tid');

    $query->condition('f.entity_type', 'taxonomy_term', '=');
    $query->condition('f.bundle', 'policy_categories', '=');
    $query->condition('f.field_department_tid', $array_departments, 'IN');
    $query->condition('h.parent', 0, '=');
    $query->fields('f');
    $query->fields('t');
    $query->fields('h');
    $result = $query->execute();

    $policy_vid = taxonomy_vocabulary_machine_name_load('policy_categories')->vid;

    $category[''] = '- None -';

    foreach ($result as $record) {
        $parent_arr = taxonomy_get_parents_all($record->tid);
        $parent_level = sizeof($parent_arr);
        $parent_level--;
        $parent_tid = $parent_arr[$parent_level]->tid;
        $parent_name = $parent_arr[$parent_level]->name;
        $category[$parent_tid] = $parent_name;

        $policy_children_arr = taxonomy_get_tree($policy_vid, $parent_tid);
        foreach ($policy_children_arr as $key => $policy_children) {
            $depth = '';
            for ($i = $policy_children->depth; $i >= 0; $i--)
                $depth .= '--';
            $category[$policy_children->tid] = $depth . $policy_children->name;
        }
    }

    $form['field_policy_categories']['und']['#options'] = $category;
} else {

    $form['field_policy_categories']['und']['#options'] = $category;
}

$form['field_policy_categories']['#prefix'] = '
';
$form['field_policy_categories']['#suffix'] = '
';

$form['#validate'][] = 'form_validate_policy_add';
}
}
function ajax_policy_category_callback($form, &$form_state) {

return $form['field_policy_categories'];
}


texts:
I am trying to make drush work on Debian 8 with Drupal 8.

Unluckily, executing drush entity-updates returns the following error messages:

  Command entity-updates needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
  Command entity-updates requires Drupal core version 8+ to run.
  The drush command 'entity-updates' could not be executed.

drush -vd status executed from .../sites/default returns the following:

.../sites/default# drush -vd status
Starting Drush preflight. [0.04 sec, 2.09 MB]                        [preflight]
Loading drushrc "/etc/drush/drushrc.php" into "system" scope. [0.04  [bootstrap]
sec, 2.09 MB]
Cache MISS cid: 7.1.0-commandfiles-0-81cc86c1995ab7206f383ec28ad43baf    [debug]
[0.09 sec, 2.14 MB]
Cache SET cid: 7.1.0-commandfiles-0-81cc86c1995ab7206f383ec28ad43baf     [debug]
[0.12 sec, 2.16 MB]
Bootstrap to phase 0. [0.53 sec, 6.04 MB]                            [bootstrap]
Found command: core-status (commandfile=core) [0.54 sec, 6.05 MB]    [bootstrap]
Loading outputformat engine. [0.54 sec, 6.06 MB]                        [notice]
Calling hook drush_core_status [0.55 sec, 6.11 MB]                       [debug]
Returned from hook drush_core_status [0.55 sec, 6.11 MB]                 [debug]
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php5/cli/php.ini
 PHP OS                 :  Linux
 Drush script           :  /root/.composer/vendor/drush/drush/drush.php
 Drush version          :  7.1.0
 Drush temp directory   :  /tmp
 Drush configuration    :  /etc/drush/drushrc.php
 Drush alias files      :

Command dispatch complete [0.63 sec, 6.25 MB]                           [notice]

Running drush sqlc executed from .../sites/default results in:

Unable to load class Drush\Sql\Sql                                   [error]
exception 'Drush\Sql\SqlException' with message 'Unable to find a    [error]
matching SQL Class. Drush cannot find your database connection
details.' in
/root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc:597
Stack trace:
#0
/root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc(454):
drush_sql_get_class()
#1 [internal function]: drush_sql_cli()
#2 /root/.composer/vendor/drush/drush/includes/command.inc(359):
call_user_func_array('drush_sql_cli', Array)
#3 /root/.composer/vendor/drush/drush/includes/command.inc(210):
_drush_invoke_hooks(Array, Array)
#4 [internal function]: drush_command()
#5 /root/.composer/vendor/drush/drush/includes/command.inc(178):
call_user_func_array('drush_command', Array)
#6
/root/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(62):
drush_dispatch(Array)
#7 /root/.composer/vendor/drush/drush/drush.php(70):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /root/.composer/vendor/drush/drush/drush.php(11): drush_main()
#9 {main}

I have read other topics but none of the solutions seems work.

I have installed Drush according to instructions provided here How to install drush 8 properly on Debian 8?.


texts: How to I retrieve default checkbox values using Form API?

texts:
How do I retrieve saved checkbox values from a field using the FormAPI?

The form/node saves successfully, and when I look in the DB, the data was successively saved in the 'field_data_field_test' table, but I can't figure out how to pull that back out and apply the 'checked' status using #default_value.

$form['field_test']['und']['#default_value'] = $How_Can_I_Get_This_Data_From_DB

Is there a function I can use to retrieve checked values for a given field within a given node?  I'm trying to avoid direct queries. :)

Edit:

Ended up using

function _get_review_site_defaults() {
    $query = new EntityFieldQuery;
    global $user;
    $result = $query
            ->entityCondition('entity_type', 'node', '=')
            ->entityCondition('bundle', 'field_test', '=')
            ->propertyCondition('uid', $user->uid, '=')
            ->propertyCondition('status', 1)
            ->execute();
    if (count($result) == 0) {
        $defaults = array(1);
    } else {
        $entities = entity_load('node', array_keys($result['node']));
        foreach ($entities as $key => $value) {
            if ($value->field_default_field_test[$value->language][0]['value'] == 'Yes') {
                $defaults[] = $value->nid;
            }
        }
    }
    return $defaults;
}


texts:
For a specific type of urls on my website I'd like to add an utm on opengaph URL, so I can track social activity on those URLs.

The token I'd like to modify is: [current-page:url].

I've tried:

[current-page:url?utm_source=share-freemium&utm_medium=shares&utm_campaign=shares-free]

But it doesn't work. Anyone can help?


texts:
I'm working on updating our current intranet to Drupal.

What I need to be able to do is take a PDF and load it in an iframe/node via Adobe Reader (or similar).

I can get something similar using (I think) CCK and FileViewer, but I'd like to remove the fileviewer wrapper and just have a standard PDF in browser.

Assume IE7/8 and Adobe Reader are installed.

Update:
Custom Formatter Module: Custom Module
Result of Module: enter image description here

Update 2

Using an Object per these instructions gives a more controlled block to build on. Ultimately I'll add a "You need Adobe installed from HERE to view THIS PDF" for the small chance of no pdf-viewer installed.


texts: There is currently a "product page" that contains combobox with the different variation values for that product category, but I'm curious if it's possible to add a table display to the product page to show all variations of that category within a table so a user can see what's available instead of manually drilling into every combobox?


texts: Drupal Commerce Custom Line Item Types without a Product Reference Field

texts:
Let me start by saying I am aware of this module: https://www.drupal.org/project/commerce_custom_product

This module works great for custom line item types that need to reference a product, however (correct me if I am wrong) this module can't be used to create custom line item types that do NOT reference a product.

I need a custom line item type, that doesn't reference a product. Which lead to the discovery of this:

http://cgit.drupalcode.org/commerce_examples/tree/line_item_example/line_item_example.module

Utilizing hook_commerce_line_item_type_info() I am able to successfully create a custom line item type, and have it automatically come with the Unit and Total price fields automatically.

All is well so far...

Now if I use the Drupal UI to add a custom field (e.g. an entity reference field, not a product reference field) to this custom line item type, I am able to do this without issue. I can add as many fields as I want.

Now for the problem...

However, when I use the admin order form and try to manually add this custom line item type to an order, the custom field(s) don't show up in the form.

I see from the documentation that I could implement the configuration, add_form and add_form_submit callbacks. But I figured any fields added through the UI would automatically show up on the form(s).

What is going on here? Must I implement the form code-side for all fields on the custom entity type?


texts: Show a menu item as expanded if on a certain node type

texts:
I have a News menu item, which then has children. I need it to be expanded if it is on a news article page, but not expanded on other certain pages.

I'm not sure which hook to use. i've played around with menu_link_alter but i can't figure out how to choose the item i'm on in order to process it. Maybe this isn't the correct way.

Any ideas please?


texts: How can I filter views within views and override all output including grouped fields?

texts:
EDIT:
User error. I was doing it wrong. You CAN customize the output of grouped "hidden" fields. Even though they are hidden from being repeated, whatever settings you have for them will work for the grouped version.
ORIGINAL QUESTION:
I have TWO content types: "Business" and "Business Offers/Events" that I'd like to combine for a view. I want to group all Business Offers by their respective businesses. But I also want to user to be able to filter the offers by the day of the week (Mon - Sunday). Most of the "offers" are repeating events like happy hours. I use the date_recur field to store the repeating event rule (or RRule). The date_recur field doesn't hold specific day of the week values anywhere, so in order to properly filter offers this way, I have to use a grouped filter (with 7 filters for each day of the week, each with a slightly different regex expression for each day).
Here's a sample of the raw input of the rrule subfield:
FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;INTERVAL=1

And here's a regex example of a filter (for Monday):
([A-Z=;0-9])*(BYDAY=)([A-Z]{2},)*(MO)(,|;|$)+([A-Z]{2}(,|;|$))*([A-Z=;0-9])*

I'd like my view listings to look like this (before the offers are filtered):
BUSINESS NAME
(other business details/photos etc)
OFFERS:
 - Taco Tuesdays (Title of Offer #1)
   (offer details etc)
   [raw rrule: FREQ=WEEKLY;BYDAY=TU;INTERVAL=1]
 - Happy Hours (Title of Offer #2)
   (offer details etc)
   [raw rrule: FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;INTERVAL=1]
 - Brunch (Title of Offer #3)
   (offer details etc)
   [raw rrule: FREQ=WEEKLY;BYDAY=SA,SU;INTERVAL=1]
 - etc

I have tried several things:

I created an Offers view, with a relationship to the Business, then grouped the fields by the business fields. I then hid the repetitious grouped business fields..added the Offers fields...and created the necessary filters (which worked). BUT...then I realized that I couldn't customize the output of the grouped fields like I could with the offers fields (I have some pretty hardcore css/javascript for this section for a custom slideshow, z-index layers, etc) so I can't just try targeting the elements with external css (or maybe I don't want to unless I have to).
I then tried to create two views so I didn't have to use grouped fields, and employed the Views Field View module in the Business view to pass a contextual filter (the business nid) to the embedded field view (of the Offers). I was able to successfully show X amount of offers under each business...and could now customize the output of all fields (albeit in two different views), BUT this now didn't allow me to ALSO filter the offers by the day of the week (or indeed filter out businesses altogether if they had no offers for a particular day). I tried passing additional contextual filters even as a proof of concept, but was unable to pass a "regex" expression to the matching field via this views_field_view module.

I do have several other ideas for attacking this problem...but I can't help but wonder if I'm spinning my wheels and just don't know drupal well enough anymore to think of a more straightforward solution.
Do any of you drupal/views pros know of a better way of configuring things so I can have FULL control over all output of all fields grouped or ungrouped AND be able to filter out offers and/or businesses by day of the week?


texts:
I have a serious problem with the core's taxonomy module (Drupal 7): I have some vocabularies containing all together about 140,000 tags. I do not show these tags anywhere or use them for filtering or anything like it. At this point they are used only for a solr search index. It would be nice to show all nodes that have a certain tag as well, but I am not using this feature yet.
Each node does not have more than 20 tags.

But nevertheless the taxonomy module eats all my memory so that the whole site is broken. I get the message

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to
allocate 75 bytes) in .../modules/taxonomy/taxonomy.module on line 1022

Does that mean, taxonomy module is not capable to deal with vocabularies that big? What am I supposed to use instead of taxonomy module to deal with big vocabularies?


texts: How to determine reason for unprocessed files in Drupal to Drupal migration

texts:
Finally ran my first file migration from Drupal 6 to Drupal 7 using UI.

3100 Items
3036 Processed
62 Unprocessed
2498 messages

I am simply trying to figure out what those 62 files are, and why they did not process.

I looked at the "messages" link for the file migration task. They all say something like:

2701   Informational   Deleted documents from index with query id:"pyli4t/file/3782" OR sm_parent_document_id:"pyl4t/file/3782" Don't know what to do with this, or how to query for unprocessed files.

I looked at the migrate_map_43b7eadb1file table for the migration task, but don't see anything that indicates what files were not processed.

I looked at the migrate_message_43b7eadb1file table and was able to locate the two files that failed using this SQL statement: SELECT * FROM migrate_message_43b7eadb1file WHERE level != 4 But, nothing about unprocessed files.

That's all I can think to do. Any suggestions?


texts:
I had build plugin type Bean which used ajax load more form . But this not working ? How to fix or change my code . This file Class extends BeanPlugin

 class IconLinkSocial extends BeanPlugin {

  public function values()
  {
    $values = array(
      'link_icon' => array(
        'font_icon' => '',
        'link_text' => '',
      )
    );
    return array_merge(parent::values(),$values);
  }

  /**
   *  Build extra settings for the block edit form
   */
  public function form($bean,$form,&$form_state)
  {
    $form = array();

    $form['link_icon'] = array(
      '#type' => 'fieldset',
      '#tree' => 1,
      '#title' => t('Icon Link'),
      '#prefix' => '',
      '#suffix' => '',
    );
     if (empty($form_state['num_items'])) {
      $form_state['num_items'] = 1;
    }
     for ($i = 0; $i  'textfield',
        '#title' => t('Icon'),
        '#description' => t('Input name icon font Autoload ,support font Awesome'),
        '#default_value' => isset($bean->link_icon['font_icon'][$i]) ? $bean->link_icon['font_icon'][$i] : ''
      );
      $form['link_icon']['link'][$i] = array(
        '#type' => 'textfield',
        '#title' => t('Link'),
        '#description' => t('Link for icon'),
        '#default_value' => isset($bean->link_icon['link'][$i]) ? $bean->link_icon['link'][$i] :''
        );
    }
    $form['add_more_button'] = array(
      '#type' => 'submit',
      '#value' => t('Add one more'),
      '#submit' => array('icon_link_add_more_add_one'),
      // See the examples in ajax_example.module for more details on the
      // properties of #ajax.
      '#ajax' => array(
        'callback' => 'icon_link_ajax_add_more_callback',
        'wrapper' => 'fieldset-link-icon',
      ),
    );
    return $form;
  }

  public function icon_link_add_more_add_one($form, &$form_state) {

    $form_state['num_items']++;
    $form_state['rebuild'] = TRUE;

  }

  public function icon_link_ajax_add_more_callback($form, $form_state) {
    return $form['link_icon'];
  }

  /*
   * Display The bean Icon Link Social plugin
   */
  public function view($bean,$content,$view_mode = 'default',$langcode=NULL)
  {
    return 'Debug';
  }
}


texts: How to define shared variables in Drupal 7?

texts: I am going to define shared variables in a multisite setup, say, to keep the value of 'manager_email'. I know that it can be done using an included php file like this. But for the sake of simplicity of maintenance and better integration, I am looking for a GUI solution to do so. I appreciate your hints.


texts:
When we declare something like

$form['textfield'] = array(
  '#type' => 'textfield',
  '#title' => 'textfield title',
  '#maxlength' => 8,
  '#required' => true,
);

The output will be something like:

  textfield title: *
  <input type="text" class="form-text required" value="" size="60" id="edit-textfield" name="textfield" maxlength="8">

However, I am willing to remove the container div and label from some of my fields, something like this:

<input type="text" class="form-text required" value="" size="60" id="edit-textfield" name="textfield" maxlength="8">

Is it possible? Are there any examples somewhere?


texts: how could I access users profile using settings parameter in drupal behaviours?

texts:
I have a behavior as follows:

Drupal.behaviors.mymodule = {
  attach: function(context, settings){
    jQuery("#edit-user-address",context).change(function(){
      console.log(" user id and other fields "+settings.user.id);

    });
  }
}

How could it be achieved?


texts: How to display content where author matches connected user?

texts:
is it possible to modify admin/content view to display only the content the connected user has created ?

If not , how to achieved that?


texts: It is possible to set up a menu item with hook_menu that points to an existing path?

texts:
The accepted answer here by marcvangend explains how to it with hook_menu_alter.  His method works, even if you skip step one (the block View).

But just out of interest: Can you do this by means of hook_menu?

So far, I've tried to put the following in hook_menu:

$items['node/%node/delete'] = array(
  'title' => 'Delete',
  'access callback' => TRUE,
  'type' => MENU_LOCAL_TASK,
);

However, that did not have any effect.

(Just to make clear, I just want the "Delete" tab, pointing to this existing path node/%node/delete.  I don't want to put a view on it.)


texts: What's the use of creating another CKeditor profile

texts:
CKeditor comes standard with 2 profiles: one for filtered html, and one for full html. Now I added a third one, but whats the use?

There are only 2 text format.. So why is it possible to create a third ckeditor profile?


texts: Missing formatter options for field from a custom table defined in hook_views_data()

texts:
I integrated a custom database table to views using hook_views_data().
$data['custom_watchdog']['message'] = [
    'title' => 'Message',
    'help' => 'Full log message.',
    'field' => [
        'id' => 'standard',
    ],
    'filter' => [
        'id' => 'string',
    ],
];

It works, as I can display values in a view, but it misses a formatter option.
For example, the Taxonomy term: Description field has formatter options which allows to select Default or Trimmed.
Why isn't it available for my custom field?


texts: What conditions may cause "The content on this page has either been modified by another user..."?

texts:
I'm working on a website which has multiple admins, some creating contents, some editing and some tagging...

I know editing one node at the same time will cause this error, is there anything else cause this error?

  The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.


texts: File save upload doesn't replace existing file despite FILE_EXISTS_REPLACE

texts:
I'm trying to force replacement of existing file with same name, if a new version is uploaded by user. I've seen a lot of posts about this topic but none that I could find addresses how to force the replacement.

I'm using a custom form, and here's the code I've been trying to make work during the form validation:

  $file = file_save_upload(
      'file',
      array(
        'file_validate_is_document' => array(), // Validates file is really a document.
        'file_validate_extensions' => array('pdf doc ppt pps avi mpg mov wmv'), // Validate extensions.
      ),
      'public://',
      FILE_EXISTS_REPLACE
  );

The revised file (let's say "file.jpg") is uploaded, but inevitably Drupal creates a new copy and renames it file_0.jpg, file_1.jpg, etc for each new version.

I even tried to programmatically delete the original file using "file_delete" prior to committing the upload but I still get the copy!

Any help would be appreciated.


texts: How to represent media as individual entities?

texts:
I need some architectural advice please.

I'm building a Drupal 8 site for the first time and I need to represent audio and video media on the site.

There are probably fields I can use but I'm looking for a solution which will allow each video or audio to be represented as individual entities on the site so I can list one audio/video entity in multiple locations on the site.

Can anyone advice on how best I should implement my media requirements?


texts: How to add comment field to custom entity

texts:
I tried to add a comment field in the Basefieldsdefinitions of my custom entity but in my view the add comment form doesn't appear:

Here's the basefielddefinition

 $fields['comments'] = BaseFieldDefinition::create('comment')
  ->setLabel(t('Kommentare'))
  ->setDescription(t('Kommentare.'))

  ->setSettings(
    array(
      'default_mode'=> 1,
      'per_page'=>50,
      'anonymous'=> 0,
      'form_location'=>1,
      'preview'=> 1,
      'comment_type'=>'image_comment',
      'locked'=>false,

      ))
->setDefaultValue(
        array(
            'status'=>2,
            'cid'=>0,
            'last_comment_timestamp'=> 0,
            'last_comment_name'=> null,
            'last_comment_uid'=> 0,
            'comment_count'=> 0,
)
)
->setDisplayOptions('form', array(
 'type' => 'comment_default',
 'settings' => array(
   'form_location' => 1,
   'default_mode'=> 1,
   'per_page'=>50,
   'anonymous'=> 0,
   'form_location'=>1,
   'preview'=> 1,
   'comment_type'=>'image_comment',
   'locked'=>false,

 ),
 'weight' => 1,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);


texts: Importing, Updating and Removing Taxonomy Terms

texts:
I have a number of taxonomy terms and some of them have sub terms that need to be updated.

Let me use a car for an example:

The Parent Term is Honda

Children Terms are: Civic, Accord, Fit

Honda
     Civic
     Accord
     Fit

I want to remove the sub terms and for every user who has selected Civic, I want their term to change to Honda.

What is the best way to accomplish this?


texts:
I have example of fetching multiple nodes with EntityFieldQuery, but i am not able to show pager. (intial question here: EntityFieldQuery display pager)

if ($type == 21) {
  $query = new EntityFieldQuery();

  $entities = $query->entityCondition('entity_type', 'node')
    ->propertyCondition('type', 'product')
    ->fieldCondition('field_razred', 'tid', array (607,608,609,610), 'IN')
    ->pager(10) // this is the bit you're missing
    ->execute();

  $nodes = node_load_multiple(array_keys($entities['node']));
  print render(node_view_multiple($nodes, 'teaser')) . theme('pager');
}

Does theme('pager') depends on something i am not aware of ? I built my theme on Framework theme. This code is in fact run in node.tpl.php (when conditions are met)


texts: How to block permissions tab for certain users?

texts:
Is there a way to block users who are allowed to edit users roles from seeing the "permissions" tab?

Can this be done without code?


texts: How do I put back de CKE image dialog box?

texts:
On Drupal 8, I can't find the image dialog box I used to have on Drupal 7.

I read this is a core issue, but my contributors are used to it and have a different level of expertise. This little dialog box allowed them to choose the size of the picture and to put the <alt> tag.

How can I put it back on Drupal 8, installing the CKE image2 plugin? Did I miss something? I can't find anything on the web of people complaining about the image dialog box suppression.


texts:
I am creating a import script, which is importing node into Drupal website from external database.

Node is inserting properly. I have added condition that node exist into Drupal website or not and I am getting the correct nid with  this condition.

When I am using node_load to load the existing node, its showing empty result.

I also checked node_load get blank, but did not get any satisfied answer.

Please forgive me if this question is duplicate.

Code Snippets:

$pricelist_query = db_query("select * from abshop_import.abshop_import_price where (result != 'I' and  result != 'O' and result != 'D') or result is NUll limit 0, 50");

$message = '';

while ($pricelist_object = db_fetch_object($pricelist_query)) {

    $product = db_fetch_object(db_query("select * from abshop_import.abshop_import_antibodies where (result != 'I' or result is NUll) and sku_model='%s'", $pricelist_object -> sku_model));

    if (!empty($product)) {

    $product_object = db_fetch_object(db_query("select nid from {content_field_pr_man_prd_numb} where field_pr_man_prd_numb_value='" . $product -> field_pr_man_prd_numb_value . "'"));

        //If product is primary antibodies
        if ($product -> primary_or_secondary == 'P' || $product -> primary_or_secondary == 'p') {

        //If there is no existing product
            if (empty($product_object)) {

                $node = new STDCLASS;
                $node -> type = 'primary_antibodies';

                //setting language of the node
                $node -> language = 'en';

                //setting the author of the node
                $node -> uid = $product -> uid;

            } else {

                $nid = $product_object -> nid;

                $node = node_load($nid, NULL, TRUE);

                print $product_object -> nid . "===>";

                print_r($node);

            }

            $node -> shippable = 1;

            $node -> model = $product -> sku_model;

            //Setting title of the product
            $node -> title = $product -> title;
            //Setting body of the product
            $node -> body = $product -> body_teaser;
            //Setting teaser of the product
            $node -> teaser = $product -> body_teaser;

            $node -> weight = $product -> uc_products_weight;
            $node -> weight_units = $product -> uc_products_weight_units;

        }

        //If product is primary antibodies
        elseif ($product -> primary_or_secondary == 'S' || $product -> primary_or_secondary == 's') {

            //If there is no existing product
            if (empty($product_object)) {

                $node = new STDCLASS;

                $node -> type = 'secondary_antibodies';
                //setting language of the node
                $node -> language = 'en';

                //setting the author of the node
                $node -> uid = $product -> uid;

            } else {

                $nid = $product_object -> nid;

                $node = node_load(array('nid' => $nid), NULL, TRUE);

                print $product_object -> nid . "===>";

                $n = node_load(array('nid' => $nid), NULL, TRUE);
                print_r($n);

            }

            $node -> model = $product -> sku_model;

            $node -> shippable = 1;

            //Setting title of the product
            $node -> title = $product -> title;
            //Setting body of the product
            $node -> body = $product -> body_teaser;
            //Setting teaser of the product
            $node -> teaser = $product -> body_teaser;

            $node -> weight = $product -> uc_products_weight;
            $node -> weight_units = $product -> uc_products_weight_units;

        }

        if ($node = node_submit($node)) {

            print_r($node);
            die ;

            node_save($node);
        }

        node_load(FALSE, NULL, TRUE);

}

}

Thanks in advance.


texts: How to replace the date field selects with one text field in Drupal 7 web forms

texts: I am using webforms in Drupal 7. Is there a way to set the date field to a single textfield instead of 3 select fields?


texts: I have just starting using Drupal today and am going through a tutorial for Drupal 7 (I am using Drupal 8). I have made several revisions; however, the Revision tab does not appear when in the Edit area. I am logged in as Admin and have permissions for everything. After several revisions I got fed up and decided to delete the node (content) by clicking the Delete tab - to my surprise, the Revisions tab then appeared to the right of the Delete tab. I cannot find any documentation on the Revisions tab only appearing once the delete button has been clicked. Is this standard behaviour or is there something that I am missing?


texts: How to Add Previous/Next Navigation on Teaser based on Views?

texts:
I have created a teaser based on views but don't know how to add a previous/next navigation. I have tried Views Navigation but it is for node only. The one that I am looking for is similar to the previous/next navigation with numbers in the front page.

Any help is greatly appreciated.


texts: How can I get the ID of a group of fields?

texts:
I have an unformatted list view with two fields, the node title and a taxonomy term. I am grouping on the taxonomy term. What I'd like to do is add a class to the
 tag for the group title, like
group name
. If I wanted to add an id for rows, I could add a counter field. Is there an equivalent variable to get the index number of a group? Maybe a preprocess function? I thought views-view-grouping.html.twig might have something to do with this, but it isn't coming into play.


texts: What are best practices for creating node relationships?

texts:
In Drupal 7, what are the best ways of creating relations between nodes?

Say I have a number of articles about famous writers. I want to build an alphabetical list of them using Views. As writers often have pseudonyms, I want these pseudonyms to appear in the list too but creating a node for a pseudonym that is identical to its respective Writer node in all aspects except title sounds like not quite good idea.

I thought a bit and came up with 2 node types, Writer and Writer_Pseudonym:

Writer

Title
Body
All other fields

Writer_Pseudonym

Title
Target Node Id

Now I want to build a view in which nodes of type Writer_Pseudonym will display body text of their target nodes:

  Title: Doe, John (Writer)

  Body: John Doe, also known as Evil John, is a writer that became famous after creating an autobiographical novel "Foobar".

  Title: Evil John (Writer_Pseudonym)

  Body: John Doe, also known as Evil John, is a writer that became famous after creating an autobiographical novel "Foobar".

Is it possible to do it with Views? And if not, are there any other ways to establish relations between nodes while being able to use fields of target nodes?


texts:
I should include nusoap library in my module, there is two way:

1- Download and extract it in my module directory and simply include it.

2- Writing another module to provide nusoap wrapper for other modules need it including mine.

I searched for existing module but I didn't find any. so which way is better?


texts:
Normally when I theme a field, I use a template suggestion in format field--fieldname--contenttype.  However, it doesn't seem to be possible to do this with the node title.  I've tried both of the following template suggestions:

field--title--contenttype.tpl.php
field--field-title--contenttype.tpl.php

Neither of them work (I've cleared caches).  The title isn't technically a field, since it's more like a property on the node object, so that may be the problem?

Is there any way to theme the title field?  It feels like I'm missing something simple.

N.b. I'm using panels and have dropped the node title pane into the panel but need to theme it differently.


texts: Check if the current user has permission to edit current node

texts:
I'm using Nodeaccess module to add permissions on specific nodes.
 in my .theme file I want to Check if the current user has permission to edit the current node.


texts: How to track mailchimp signup form location

texts:
Mailchimp has an article that explains how to track signup form locations by adding hidden fields to the mailchimp form.

All well and good, but if you put the form in a Drupal block, the location of the form suddenly becomes a variable.

I'm wondering if the token module, and a token in place of a hard-coded hidden field value that tracks location, would be a good approach? The form code for the hidden field currently looks like this:

 <input id="SIGNUP" name="SIGNUP" type="hidden" value="global" />

So, the value "global" is the one that needs to change based the the page that the block is displayed with.

I'm not sure about which token to use, but thinking I'd use something like the page title or page url. In the case of a simple block, do I just need to get and enable the token filter module?

Any thoughts on token as a good option, or other ideas I should consider?

Note - this has nothing to do with the mailchimp module (http://drupal.org/project/mailchimp), which I don't have installed on this site since this site doesn't yet have any notion of user logins.

Links:
token and token_filter.


texts: How do I Group Repeatable Fields Programatically?

texts:
I'm in the middle of coding a custom entity in Drupal 8. Currently, I'm defining fields using the baseFieldDefinitions method. I've run into a small problem now where I have a subset of fields that need to be grouped together and repeatable. For example, I have a checkbox, a text box, and a select box that all need to be associated while allowing someone to click an "Add" button to produce another set of those three fields.

It seems that if I was using the UI to create a custom content type, then I could use Paragraphs to handle this, but I wasn't able to figure out how to do that in code, and all the modules that are used in Drupal 7 as example of how to do this either don't exist in D8, or point to using Paragraphs instead.

Some ideas that I had:

Create all three as repeatable fields in baseFieldDefinitions and override the form to present them as a unit and write some ajax to make it work the way I want. I don't think this is ideal because it seems like I'm fighting the framework.
Make this group of fields into their own entity and try to figure out how to add an entity creation form inside my parent entity creation form. I'm not sure if this is possible, but it seems like it should be.
Use hook_schema to create a database table with the three fields that I need and an additional column to tie that record to my custom entity. This is the way I would have done it in Drupal 7, but I'm worried about the long term of running reports in Views using the data that isn't in the Entity itself. This seems like the quick and dirty way to do it but I don't want a Views headache later.
Figure out how to do this in Paragraphs.

Hopefully, someone with a little more experience than I have in D8 can point me to the most preferable way to handle this. Any help would be greatly appreciated.


texts: how to implement substring() in db_select statement

texts:
I am porting a drupal 6 module to drupal 7. I came across this SQL query:

SELECT count(*) AS total FROM {counter} WHERE SUBSTRING(counter_date,1,10)= '%s'

How to implement the same query in db_select. db_select() will have substring() in its condition clause.


texts: How do I overwrite node title for specific content type?

texts:
I'm trying to add a chapter tag (§) in front of a title for content type 'ABC' in a Drupal 7 site.

I tried the following:

function mytheme_preprocess_node(&$variables) {
  if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
    $variables['classes_array'][] = 'node-full';
  }
  //watchdog("mytheme_preprocess_node", 'items %items', array('%items' => print_r($variables['node'], true)));
  $node = $variables['node'];
  if ($node->type=='abc') {
    $node->title = 'this is a test' . $node->title;
    $variables['node'] = $node;
    watchdog("mytheme", 'items %items', array('%items' => print_r($variables['node'], true)));
  }
}

I did see the message output in the log, however updated title is not showing up on the site.


texts: How should I implement an alternative file upload?

texts:
I want to write a module for Drupal 7 to integrate http://filepicker.io's awesome functionality. It's a simple JS widget that returns a URL of where the file is hosted.

I've never written a D7 module before, though I've written several for D6.

Should I create this as a fields widget (and if so, for which fields- file/image/link?), or should I create a whole new field type for this?

In production, my intent is to mix up the types a bit with this; that is, we have lots of images uploaded already, I'd just like to upgrade the 'upload' button (in lay terms) without breaking everything.


texts: Create a view of users to show their profile visits

texts:
I need to track the IP address in order to have a good idea on how many users visit each profile. This report will be available only to the admin.

I have used User Visits Advanced module

The problem is that even user can also see his profile visits by using this module.I was also trying to figuring out how to create view of recent visitors using this module but finally unsuccessful.

I just want to create view report of users and their respective profile visits .


texts: I can't see the view twig into my module

texts:
I have test already to an over module for seeing the view but it doesnt work.

I have used the Drupal Console project (i can't tag it :/ ). I dont understant why i can see the view Twig. When you can see with the link to the github project, i have create into the module hello_world the repertory "templates" who they have into the "world.html.twig"

My HelloController has located into src/Controller/HelloController.php

/**
 * @file
 * Contains \Drupal\hello_world\Controller\HelloController.
 */

namespace Drupal\hello_world\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Class HelloController.
 *
 * @package Drupal\hello_world\Controller
 */
class HelloController extends ControllerBase {
  /**
   * World.
   *
   * @return string
   *   Return Hello string.
   */
  public function world() {
    return [
        '#theme' => 'world',
        '#texte' => $this->t('Hello world ! ')
    ];
  }

}

Where comming my error? From the Controller, fromm the hook?

/*hello_world.module*/
function hello_world_theme() {

    return array(
        'world' => array(
            'template' => 'world',
            'variables' => array('texte' => NULL)
        ),
    );

}

I'm bloking on this since 2 day.

Github project :
https://github.com/emilienGallet/DrupalUnicef/commit/2d46cee1a5b12f9ab8ef59d16a39ccfd7ce0769a

Command of Drupal console executed before :

drupal generate:module
drupal generate:controller
drupal cache:rebuild

Thanks for the Future Helping :)


texts:
I have a use case where I want to add multiple fields grouped together to an entity, field collection is perfect for this and I have it working well now this way.

Field collection stores all field collection entities in one table in field_collection_item, so if I had another field collection that had a huge number of rows would it effect performance? If so then I would like to store these other fields groups somewhere else, maybe an entity reference so these fields are in their own table. How would I convert my field collection to entity reference.

Can I duplicate the functionality of field collection with entity reference? As essentially an entity reference and field collection are the same. But if I had an entity reference it would be in it's own table that is less crowded.


texts: Nivo Slider lists up the images instead of sliding

texts:
I download this module with drush dl nivo_slider
Then enable and automatically download libraries with drush en nivo_slider
Then clean cache with: drush cc all
Then enable in block.

Then Firebug said: TypeError: $(...).nivoSlider is not a function
$('#slider').nivoSlider({

and chromium said:
Uncaught TypeError: undefined is not a function nivo_slider.js?ne2hej:11Drupal.behaviors.nivoSlider.attach nivo_slider.js?ne2hej:11(anonymous function) drupal.js?ne2hej:76b.extend.each jquery.min.js?v=1.9.1:3Drupal.attachBehaviors drupal.js?ne2hej:74(anonymous function) drupal.js?ne2hej:412c jquery.min.js?v=1.9.1:3p.fireWith jquery.min.js?v=1.9.1:3b.extend.ready jquery.min.js?v=1.9.1:3H jquery.min.js?v=1.9.1:3

I'm using later version of Drupal 7


texts: Any way to set Drupal theme settings per page?

texts: I have a theme which has multiple theme options in its settings page. Is there a way to assign particular theme settings to specific Drupal paths?


texts: How to make the language of the subscriptions be the currently language in Simplenews

texts:
I'm implementing simplenews on a Drupal 8 Website, and I currently came across a problem with the anonymous user subscriptions to the newsletters.
According to the documentation of simplenews, when someone subscribe anonymously to a Newsletter, the preferred language would be the interface language of the page, but the language setted to the subscriber is always being the default language of the website, I tried many configurations about language and have no success.
So, that is the problem, I want that when someone subscribe to the newsletter, the language setted for the subscriber be the interface language of the page, please tell if anybody knows a solution for this.
Thanks in advance.


texts: How to sync a Drupal calendar with an iphone/ipad Calendar?

texts: Is there a way for us to sync our Drupal calendar to an iphone/ipad calendar?


texts:
I have a content type with the field_watermelons and field_apples fields. I want to record the sum of these fields in the (existing) field_total_fruits field. How can I achieve this?

I do not want to use the Computed field module(because of PHP filter requirement) and the Math Field module is also out because it can't handle Field Collections at the moment (if it could, then I'd have my answer).

I tried hook_form_alter with a callback function attached to the $form['submit']. In that callback, I've tried a number of methods of inserting new values including adding values to $form_state's input, values, completed_form. I've also tried to use entity_metadata_wrapper() approaches in the callback, to no avail. I also tried form_set_value().

How to create a Rules action set to calculate a sum of integers in a Field Collection? looks interesting, but there's no answer.

Surely I'm over-thinking this. Can someone tell me if there's a simple way to sum two field values and insert that sum into the value of another field programmatically?

I suppose I could use the Drupal AJAX system too. I just didn't want that hassle, thinking that there's an easier way, but perhaps it's the best option.


texts: How do I create a block that has links to site registration and forgot password programmatically?

texts: Can anyone help me writing code for a block containing the "Register" and "Forgot your password?" links that are shown to the anonymous users?


texts: Different front page depending on previous selection for anonymous users

texts:
I have a D8 project where the client wants users to select a route they will follow depending on who they are (let's call the two groups Students and Employers), and then the next time they visit show the home page for the appropriate group.

So for example if they click mydomain.com/students, the next time they visit mydomain.com/ it will redirect them to /students

The users will always be anonymous, so not logged in.

I have seen various solutions to this (e.g. the Front module), but they all seem to be dependent either on user role (no use for anon users), a subdomain or browser locale, none of which help us.

What I have in mind is that when visiting one of the target landing pages (e.g. /students) with a Referrer header of the home page, we set a cookie or session variable. Then when the root URL is requested with no or an external Referrer header (so you can still go to the proper homepage via navigation), we check for this and send a redirect if appropriate. The actual paths used could be saved in config.

I'm sure there is a hook I can use somewhere in core to do this, haven't looked into it in much detail yet, but my biggest concern is caching. If the homepage is cached, the hook would never fire and we wouldn't get the redirect, but at the same time I don't want to disable caching on the homepage.

Any experiences/ideas here would be very much appreciated.


texts: How to set the text format of a field in a node object?

texts:
When I create a node like this:

$nodeSetup = [
  'nid' => NULL,
  'type' => $bundle,
  'uid' => $uid,
  'revision' => 0,
  'status' => 1,
  'body' => ['format' => 'full_html', 'value' => Xss::filter($body)],
];
$_node = Node::create($nodeSetup);

the body value and format work fine. But, when I load an existing node, how can I set the body value keeping the format? This didnt work:

$_node->body->format = 'full_html';
$_node->body->set('format', 'full_html');
$_node->save();


texts: How to use voting results to boost relevance for solr search?

texts: I am using search api with the solr backend to index thousands of nodes. All of them have votes (vote api). Now I am wondering how to boost the relevance of these notes by their vote. I don't want to sort the result completely by votes (this would be easy), but that the votes boost the node's relevance for a certain percentage. Is that possible? How to do this?


texts: Image attribute function on all image styles

texts:
I have a function in template.php:

function mytheme_preprocess_image(&$variables) {
   if ($variables['style_name'] == 'gallery') {
       $variables['attributes']['class'][] = 'lazy';
       $variables['attributes']['data-original'][] = file_create_url($variables['path']);
       $variables['path'] = 'themes/mytheme/images/grey.png';
   }
}

It works good. But now, I want this function on all image styles. So, removed if block but not working and crashed my site.

function mytheme_preprocess_image(&$variables) {
       $variables['attributes']['class'][] = 'lazy';
       $variables['attributes']['data-original'][] = file_create_url($variables['path']);
       $variables['path'] = 'themes/mytheme/images/grey.png';
}

How can I apply this function on all image styles?


texts: What Drupal development environments are available besides XAMPP?

texts:
I am using XAMPP for almost 2 years. Recently i found some articles that suggests that XAMPP is loading some extra libraries/dlls which is not required for a Drupal development environment.
Is there any other options that i can adopt for Drupal development besides XAMPP?

I found nginx.


texts: Disable Rule which is causing a redirect loop

texts:
I have created a rule for logged in members that if they go to the home page it redirects them to a different page. The home page needs to be different for anonymous and authenticated users.

One problem is that my rule is not working. I have created a redirect loop by mistake. This means I can not get to the rules interface to disable the module. I know I could disable the rules module via drush however I will have the same problem when I turn it back on.

I had a quick look in db and see the rules_rules table. However the data is stored as a blob so I can not edit it. Except for deleting my rules what could I do to disable it?


texts: Drupal 7 - HTTP/AJAX/JSON responses at same URL with Accept Header (like D8)

texts:
Drupal 8 has this new amazing in-built functionality for handling requests from browsers and via AJAX at the same URL using the Accept header, which makes the CTools way of adding "nojs" to URLs, and then changing that to "js" in the JavaScript seems like a clever but antiquated hack.

Is there a cleaner way to do this, that could be considered a "best practice" for Drupal 7 going forward, that is more inline with how things are now done in Drupal 8?   Also, how does a traditional ajax response versus a json response factor into this?

Code examples would be highly useful here.


texts: SCORM (v 1.2) integration for Quiz module

texts:
We are looking for SCORM integration with Drupal's Quiz module.

Essentially we should be able to Import/Export quizzes and questions as SCORM package(s). Ideal if SCORM player can be used for quiz taking and Results/Feedback displaying.

I couldn't find any library or API to ease up the integration work. Wondering if I have to write my own Importer and Exporter to handle this requirements.


texts: How can I restrict view pemissions to a node related child nodes?

texts:
Let's say I have a parent node with ID equal to 233 that has the following related nodes: 234, 235, 236 (in a relationship field).
Is it possible to restrict access to paths node/234, and node/235, if they are a specific content type, but still show them for the same users in a embedded view inside a local task of ID equal to 233?


texts: How do I setup the date picker popup for date fields in a view?

texts:
I setup a date field for my content type and also have an exposed date filter for my view, but I can't seem to figure out how to get the date picker popup to show up. Is there a setting that I have to set somewhere?

I've also installed Better Exposed Filters and I still don't see any option for my view. Also installed Date and the Calendar module. I know jQuery UI has a built in calendar popup and that's installed by default on Drupal 8 installs.

How do I turn this on?


texts: Update some field values after user update own account

texts:
On my Drupal 8 project, usernames are only allowed to be emails. For that, on account creation, I am setting the name field equal to the email field, and users don't have the permission to edit their own usernames.

I am writing the code to update the username when the users change email. This is the code I wrote so far.

/**
 * Implements HOOK_user_update().
 * Set Username = mail if mail has been updated by user.
 */
function hook_user_update($account) {
  $current_user = \Drupal\user\Entity\User::load($account->id());
  $original_email = $account->original->get('mail')->value;
  $updated_email = $current_user->get('mail')->value;

  if ($original_email != $updated_email) {
    $current_user->setUsername($updated_email);
    $current_user->save();
  }

}

Since the code is saving a user object, the same hook is invoked again when $current_user is saved. I also tried with hook_user_save() and hook_user_presave(), but they don't work until I include $current_user->save(); in the code.

Update:

Using hook_user_presave()

function custom_module_user_presave($account) {
  $current_user = \Drupal\user\Entity\User::load($account->id());
  $original_email = $account->original->get('mail')->value;
  $updated_email = $current_user->get('mail')->value;

  if ($original_email != $updated_email) {
    $current_user->setUsername($updated_email);
    \Drupal::messenger()->addMessage(t("if"));
  }
  else {
    \Drupal::messenger()->addMessage(t("else"));
  }

However, after updating the email and saving an existing user, I always get the message: else which means $original_email != $updated_email which is logic as the user has not been not saved yet.

any help please ?


texts: How to set a conditional webform to copy the value of a field to another?

texts:
I'm trying to design a webform in Drupal 7. We have a separate entries for a "student postal address" and "guardian postal address". A request appeared to have a "use same address" check box.

Is there a way to attempt this without custom coding? Optimaly, I'd love to select the value of another field using the Webform Conditional UI shown below.


texts: Toggle CCK field visibility with CCK radio buttons

texts:
I have a content type with three cck fields

1 radio button, 1 text field, and 1 integer field.

What I am trying to do is by default have the text field and integer field hidden, and only show them dependent on the state of the radio button.

Example:

Two radio buttons, one which says text and one which says integer.  When the text radio box is checked, then the text box shows and the integer box is hidden and vice versa.


texts:
I've 3 modules which implement the form alter beccause I need a new field with a different value function of the module (partner, beneficiary, collectivity)
My issue is, the field value take the value from the last module visited.

For example, on the page /beneficiary, I would like my login form with the profil value as "BENEFICIARY" but I have the "PARTNERS" value instead beacause it's the last visited.

All my 3 form_alter() methods are the same (except the function name of course :) )

function partners_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'user_login_block':
      $form['profile'] = array(
        '#type'             => 'textfield',
        '#title'            => t('type'),
        '#value'            => 'PARTNERS',
        '#required'         => True,
      );
      break;
  }
}

How can i prevent Drupal to parse all modules or do you have an idea on how to implements ?


texts:
Let's suppose I have a simple content type with title, body and file fields, and file field is multi value. I create a piece of content and upload some file in my field. Finally my content is something like

title : my title
body  : somebody text come in body

file  :

file1
file2
file3

My question

I can change the order of files in node edit by drag them up or down, I want to know how I can load a file programmatically by its weight. I mean I want to upload a file that is shown first or second in node edit mode. How can I upload file form node programmatically, ordering by weight?


texts: How to create a includes folder inside sites/all/module/custom/

texts:
I want to create a folder name include in-side sites/all/custom/contrib/  and  inside this want to write some .inc files like date.inc, string.inc in each file a class is created which holds function.

Now I want to use this functions in each module under sites/all/custom/contrib. I have 10 custom module so this .inc functions are available to each custom module.

What is the directory structure I have to follow and how can I achieve this?


texts: Feeds is not importing images into subfolders

texts:
I'm trying to import external nodes from html pages. all working fine but i just cannot make image getting saved in a subfolder.

am mapping a uri value "public://posts/2014/03/4587214.jpg" to "image:uri" and i want the file to be saved in "sites/default/files/posts/2014/03/4587214.jpg" but the file is getting saved in "sites/default/files/posts/4587214.jpg" instead . ("posts" is the value of the subdirectoy in the content type)

any advice on how to make feeds save images in subfolders ? (and create these on fly if do not exist)

i can do it by hacking "feeds/mappers/file.inc" and changing the value of $destination variable as follows:

case 'uri':
if ($v) {
try {
/* patch - start */
/* added to allow subfolder destination */
$uri = $v->getValue();
$uri_target = file_uri_target($uri);
$uri_scheme = file_uri_scheme($uri);
$uri_path_info = pathinfo($uri_target);
$destination = file_stream_wrapper_uri_normalize($uri_scheme . "://" . $uri_path_info['dirname']);
/* patch - end */
$file = $v->getFile($destination);

but i was wandering if this can be done without hacking feeds source files


texts: How to have one node's access dependent on another node's access?

texts:
I've got two content types. One we'll call "company"; the other, we'll call "project".  Companies can have projects, managed by a field in the project.  Companies and projects can also have fields that determine their visibility; each of them can be marked "public" or "private".  Node access rules are used to control access to the nodes, based on the value of that field.  All of this is working fine.

What I'd like to do is make it so that, if a company is marked "private", all of its projects also become private, in the sense that people other than the company's owner get access_denied if they try to look them.  However, if the company's access is returned to "public", the access rights of the projects are restored to whatever their own visibility setting specifies.

Here's what works for me at the moment.  My concern is that it requires directly hacking the node_access table, which, aside from the fact that it works, bothers me...

Add two bits of code to the company's _node_access_records() handler:

When the company's visibility changes from public to private, for each of the company's projects: blow away the entries for the project in the node_access table and insert a "only the author can access" right.
When the company's visibility changes from private to public, for each of the company's projects: again blow away the entries for the project in node_access, but this time get the access rights for the project by calling its node_access_records() handler and insert the corresponding rights into node_access for that project.

Any other ideas out there, perhaps something that (in particular) avoids the direct hacking of node_access?


texts: Set value for new field automatically based on another field

texts:
I want to add a new date field to an existing content type, and set the new field automatically for existing nodes to be equal to another date field from that content type.

For example, if the new field is called 'Event date', and there is an existing field 'Publication Date', I want the 'Event date' field to contain the date from the 'Publication date' field for all existing nodes, without assigning each one manually.

Is this possible?


texts:
I am migrating from a another non Drupal CMS. I have 4 tables:

stories (story1, story2, story3)
story_tags (story_id, tag_id)
tags (ABC, NBC, WTOP, CBS, clinton)
tag_types (radio, tv, person)

How can I link tags to stories by tag_type. So that when I open a story I can see all it's related tags, knowing that a story can have several tags.
Any good detailed tutorial of migrate module link will be appreciated also.

update
How can i translate this in a migrate query

SELECT t.name FROM tags t
    join tag_types tt on (tt.id = 3)
    join story_tags stg on (stg.tag_id = t.id) WHERE story_id = $row_id'

Tried but it is not working:

->select('story_tags', 'tags')
->fields('tags', array('tag_id'))
->leftJoin('tag_types', 'tt', '(tt.id = tag.tag_type_id)')
->condition('tag_type_id', '3', '=' )
->condition('story_id', $row->id, '=')
->execute()
->fetchCol();

What am i missing?


texts: How to replace teaser/content for anonymous users

texts:
I'm kind of new to Drupal so please bear with me. My question is, is it possible to replace the teaser/content for anonymous users? I have some restricted content but I don't want it to be removed and hidden from anon users, just show something that says they should be logged in to view the content/teaser. I've searched for hours and everything that comes up hides the content completely. I've seen a module that kind of does this thing (restricted content module) but it's only available on d6. I'm using d7.

Thanks in advance!


texts: Display all nodes for which user appears as a field on that user's profile?

texts:
I have a site with a content type "Projects," which has a field "Project Manager" that takes a user. Is there a good way to display all Projects for which a user appears as the Project Manager for that Project on that user's profile?

Update:

Here is what I have so far in user_profile.tpl.php

...
function my_module_user_view($account, $view_mode, $langcode) {

  $my_field = 'field_pm';
  $uid = $account->uid; // The uid of the user being viewed.
  $query = "SELECT entity_id FROM {field_data_{$my_field}} WHERE {$my_field}_target_id = :uid AND bundle='user'";
  $args = array(':uid' => $uid,);
  $result = db_query($query, $args);
  $nids = $result->fetchCol();
  if (count($nids)) {
    $projects = node_load_multiple($nids); // Load all projects where that user is a PM
    foreach ($projects as $project) {
      $account->content['field_pm_projects'][0]['#markup'] = $project->title;
    }
  }
}
?>

<div class="profile"<?php print $attributes; ?>>
 <?php print render($user_profile); ?>
 <?php print $account->content['field_pm_projects']; ?>


texts:
We are running Drupal 8.8.5. I can see duplicate aliases when I look at /admin/config/search/path.

Unfortunately, there are many duplicate aliases on our website with 6000 URLs. The /node/1 node has three translations: en, es, and zh-hans.  /node/1 also has a second entry for es containing a duplicate path alias which I would like to delete.

I need to find a way to programmatically delete path aliases. If I have Create, Read, Update and Delete (CRUD) operations on the path/alias/langcode, I can create a solution to eliminate the duplicates.

The following code obtains the alias data associated with the node whose ID is equal to 1 and dumps the Path, Alias and LangCode.

$alias = \Drupal::entityTypeManager()->getStorage('path_alias')->load('1');
var_dump($alias->getPath());
var_dump($alias->getAlias());
var_dump($alias->language()->getId());

The base language of the website is English, and the last var_dump() yields en.  So far so good.

How can I gain access to the alias data for these two languages?  I know the following works.

$alias_es = \Drupal::service('path_alias.manager')->getAliasByPath('/node/1','es');

I need to delete the duplicate Spanish path alias to accomplish my goal, so I need to figure out how to use entities which have a delete() method.  You might think the following code should work.

$alias_es = $alias->getTranslation('es');

It returns:

  InvalidArgumentException: Invalid translation language (es) specified.

I also tried $alias->getTranslationLanguages(), which returns an array with only one element (['en'] => object(Drupal\Core\Language\Language)).

It appears that our original $alias = \Drupal::entityTypeManager()->getStorage('path_alias')->load('1'); only has one language translation which is English.

How can I gain access to the path aliases for es and zh-hans?


texts: Specify a node type (bundle) in entity reference field

texts:
I have a custom entity type which has an entity reference field.

   $fields['referenced_article'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Article'))
  ->setDescription(t('The associated article.'))
  ->setSetting('target_type', 'node')
  ->setSetting('handler', 'default')
  ->setDisplayOptions('form', array(
    'type' => 'entity_reference_autocomplete',
    'settings' => array(
      'match_operator' => 'CONTAINS',
      'size' => 60,
      'placeholder' => '',
    ),
    'weight' => -3,
  ))
  ->setDisplayConfigurable('form', TRUE);

This field returns now the nodes of all the node types when finding a match. How can I specify a node type? (I only want to show the nodes of type "article")

Do I need to use a specific setting for selecting content only one node type?


texts: Change the value of a field depending on the selection of another

texts:
I need to change the value of a field based on the selection of another.   I also don't want the user to have the ability to change this value.  I tried using #disabled = true, but the values don't save, and the same with #access.

I'm not sure how to go about this?  #disabled seems to stop values from being saved - what alternatives are there?

This surely can't be unique, I know often date fields do this.


texts: drupal 7.12 : multiple taxonomy vocabularies in a single view exposed filter

texts:
One of my colleagues is working on a project for a departmental store. she wants to create a single views taxonomy drop down filter with multiple (7) vocabularies. The Vocabulary name should appear in the drop down menu but should not be selectable. Some of the vocabularies and their terms are as follows.

Footwear - sandals, shoes, boots, pumps etc

Trousers - chinos, jeans, bottoms

T-shirts - polo shirts, polo neck tops etc

Dresses - maxi, ballgown, one shoulder, tunic etc

Accessories - bags, watches etc

Questions is, is it best to use multiple vocabularies or one vocabulary with multiple parent terms and children. If she uses multiple vocabularies (e.g.. footwear, trousers, tshirts) how can she make the terms in each vocabulary appear in one filter as well as the vocabulary name (but should not be selectable).

On the other hand, if she uses one vocabulary with multiple parent terms and their children, hood can she make the parent terms appear in the drop down menu but not selectable. she tried this method but the drop down is too long and the parent terms are selectable.

alternatively, is it possible to make the vocabulary names appear in one filter and have another filter conditionally showing the terms in the vocabulary selected in the first filter. To add to the complexity, the second filter should show the terms with products and hide those without (this is not a priority). This method will be beneficial but she has no idea how to implement this.

Any suggestions will be greatly appreciated. Thanks in advance.


texts: Is there a way to stop Order checkout in Commerce 2.x?

texts:
Is there a way to stop an Order checkout process in Commerce 2.x when a product is out of stock?

Requirement:

I have a product with quantity in stock available as zero
A user/customer logs in
Customer clicks Add to cart button
Product must not be added to cart since it is unavailable in stock

I have used getSubscribedEvents() with Commerce order event commerce_order.commerce_order_item.insert. But the following code just won't work. I suspect it has something to do with the order of execution of  Symfony events but really don't understand where am I missing out. My code :

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events['commerce_order.commerce_order_item.insert'] = ['stopOrderExecutionOnStockUnavailability', 100];

    return $events;
  }

  /*
    -----
    -----
    -----
    -----
    -----
  */

  /**
   *
   * @param \Drupal\commerce_order\Event\OrderItemEvent $order_item
   *   OrderItemEvent object.
   */
   public function stopOrderExecutionOnStockUnavailability(OrderItemEvent $order_item) {

    $ordered_quantity = $order_item->getOrderItem()->getQuantity();
    $purchased_entity = $order_item->getOrderItem()->getPurchasedEntity();
    $stock_entities = $purchased_entity->get('field_stock_management')->getValue();

    // Check for available quantity in stock - in total.
    $available_quantity = 0;
    foreach ($stock_entities as $stock_entity) {
      /*
        Get total available stock quantity here.
      */
    }

    if ($ordered_quantity > $available_quantity) {
      $order_item->stopPropagation();
      drupal_set_message(t('Ordered quantity is not available in stock.'), 'error');
    }
  }


texts:
Am using WebSpeech Module to convert the text to speech. But when I click on the read content button it reads from the headings, primary tabs instead of main content alone.

In Webspeech configuration the Element ID is "content" class, but still it reads everything.

Any solutions?


texts: Grouping by day + events spanning several days

texts:
This is a question that has already been asked on Drupal.org. It's exactly what I need on my view, but it hasn't been answered yet.

Posted by Amanda-333 on April 12, 2011 at 5:58am
I wanted to ask how I can group events by day in a view.

It works fine if I only have events that have their start- and endtime on the same day.
2011-04-12
2011-04-12 10:00 – 2011-04-12 18:00 Event 1
2011-04-12 12:00 – 2011-04-12 14:00 Event 2

2011-04-13
2011-04-13 10:00 – 2011-04-13 18:00 Event 5
2011-04-13 12:00 – 2011-04-13 14:00 Event 8

The problem: I have some events that take several days or weeks.
Example: I create one event with the start date of 2011-04-12 10:00 and the end date of 2011-04-15 19:00 for example.

This event now shows up in the grouped view as
2011-04-12 - 2011-04-18
2011-04-12 10:00 - 2011-04-15 19:00 Event 11

I would like to have that event sorted into the regular day groups (split that event into day parts):
2011-04-12
2011-04-12 10:00 - 2011-04-15 19:00 Event 11

2011-04-13
2011-04-12 10:00 - 2011-04-15 19:00 Event 11

2011-04-14
2011-04-12 10:00 - 2011-04-15 19:00 Event 11

2011-04-15
2011-04-12 10:00 - 2011-04-15 19:05 Event 11

Similar to how it is done in the calendar – day view. But with a simple text list format.
I can not find a way to do this? Perhaps someone can give me a little help?

https://www.drupal.org/node/1124616


texts: modify Drush uli returned URL string of to include port?

texts:
I want to modify a variable (preferably in a Bash Script format) because my PHP environment requires a port number.

To open a browser in Drush, one executes

$ drush uli

In a script:

$ bash-3.2$ VAR='drush uli'; echo ${VAR}; ${VAR}

outputs:

  drush uli

http:/ /website-7-26-2-17-res124725.local/user/reset/1/1393147909/zMiquSr_ikA7xdp7kA3g4CvTGd82mWsVdqEiMCs/login

Can I modify that URL before Drush opens the browser?

Can I stop it from executing and manipulate the URL in a Bash script?


texts:
I have used panels to override the node pages(node template). I have created a views block, it has an image field and its output has been rewritten so that it is rendered as a image link. Now, I want to configure the views such that it will display the panels page(node page that has been overridden by panels).

What will be the URL of image link so that it points to node page. And also it has to pass certain arguments to the node page. How to do it?

I am using D7


texts: Increment form field value by one on submit form with Ajax cal

texts:
I have my custom form:

class MyCustomForm extends FormBase{

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'my_custom_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['point_field'] = [
      '#type' => 'value',
      '#markup' => '0',
    ];

    $form['actions'] = [
      '#type' => 'submit',
      '#submit' => ['::addOne'],
      '#value' => $this->t('Submit'),
      '#ajax' => [
        'callback' => '::setMessage',
      ],
    ];

    return $form;
  }

  /**
   * Submit handler for the "add-one-more" button.
   *
   * Increments the max counter and causes a rebuild.
   */
  public function addOne(array &$form, FormStateInterface $form_state) {
    $point_field = $form_state->get('num_points');
    $add_button = $point_field + 1;
    $form_state->set('num_points', $add_button);

    $form_state->setRebuild();
  }

  /**
   *
   */
  public function setMessage(array $form, FormStateInterface $form_state) {

    $response = new AjaxResponse();
    $response->addCommand(
      new HtmlCommand(
        '.result_message',
        '
' . t('Results is @result', ['@result' => ($form_state->getValue('point_field') + 1)]) . '
')
    );
    return $response;

  }

  /**
   * @inheritDoc
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    // TODO: Implement submitForm() method.
  }

}

When the user clicks the button, I want the 'point_field' field value updates and increment by one, with an Ajax call.

Now it's adding just 1. How do I build in a for loop, when the user keeps clicking the button it will increment by one? Then in the for loop I can control how many times the user can add a point... e.g. $i<2?


texts: How can I run Drush as user 1 in version 5?

texts: Drush v3 had a --user flag (--user=1), however, this seems to be removed since v4, according to the website.  How can I run Drush 5 as logged in as user 1?


texts:
As the question says, im not clear on how to go about adding new input fields depending on values of certain fields in the form.

I got as far as setting a callback and a wrapper, but i just can't seem to rebuild the form, i can do basic returns of values from the callback, but that's about it.

If anyone could show me a clean, simple way where i could go from, that would be great!

<?php

//Create raffle form
function raffle_create_form($form, &$form_state)
{

    //Basic raffle info
    $form['raf_raffle_name'] = array(
        '#type' => "textfield",
        "#prefix" => "
Raffle information

",
        "#title" => "Raffle Name:",
        "#required" => TRUE
    );

    $form['raf_allowed_number'] = array(
        '#type' => "textfield",
        "#title" => "Number of allowed members",
        "#required" => TRUE,
        '#element_validate' => array('element_validate_number')
    );

    $form['raf_start_now'] = array(
        "#type" => "checkbox",
        "#title" => "Start raffle now?"
    );

    $form['raf_end_date'] = array(
        "#type" => "date",
        "#title" => "When to close this raffle?",
        "#required" => TRUE
    );

    $form['raf_prize_type'] = array(
        '#type' => "select",
        "#options" => array('gift' => 'Steam Gift', 'hardware' => 'Gaming peripherals'),
        "#title" => "Prize type",
        "#ajax" => array(
            'callback' => 'raffle_create_form_type_steam',
            'wrapper' => 'steam_options',
        ),
    );

    if(isset($form_state['values']['raf_prize_type']))
    {
        $form['raf_steam_options'] = array(
            '#type' => 'textfield',
            '#title' => 'Added div',
            '#prefix' => '
',
            '#suffix' => '
'
        );
        $form['raf_steam_options']['#description'] = 'configure some steamy steam steam';
    }

    $form['raf_prize_name'] = array(
        '#type' => "textfield",
        "#title" => "Prize name",
        '#prefix' => '

',
    );

    $form['raf_prize_about'] = array(
        '#type' => "textarea",
        "#resizeable" => true,
        "#title" => "Prize description"
    );

    $form['raf_prize_thumb'] = array(
        '#type' => "file",
        "#title" => "Prize thumbnail"
    );

    $form['raf_prize_link'] = array(
        '#type' => 'textfield',
        '#title' => "Link to product"
    );

    $form['raf_raffle_create'] = array(
        '#type' => 'submit',
        '#value' => "Create Raffle",
    );

    $form['#submit'][] = 'raffle_create_form_submit';

    return $form;
}

function raffle_create_form_validate($form, &$form_state)
{

}

function raffle_create_form_submit($form, &$form_state)
{
    dsm('i printed');
}

function raffle_create_form_type_steam($form, &$form_state)
{
    dms('hi');
    return $form['raf_steam_options'];
}


texts:
I am trying to import some users from a phpBB forum and found an odd thing: in phpBB I have some users with weird characters in the username. Eg: Henriëtte .

The problem is that in Drupal I can't create 2 users with the username "Henriëtte" and "henriette". Apparently "Henriëtte" = "henriette" and this will give an warning saying that the username already exists.

Is there any way to import both usernames in Drupal? Thanks.

[LATER EDIT]

The database encoding is utf8_general_ci. Also, after further investigation the user_load_by_name() function is responsible for returning a valid user even if one letter is different (ë > e). Also, user_load_by_name will in the end use entity_load() to load the user object.


texts: How do I place a block in a region, programatically?

texts:
Why isn't my custom block rendering in the region I want? It shows in the content region, not my custom content_right region.

function bootstrap_preprocess_html(&$variables) {
  if (\Drupal::routeMatch()->getRouteName() == 'some.path') {
    $block = \Drupal::entityManager()->getStorage('block_content')->load(12);
//kint($block);
    $block_view = \Drupal::entityManager()->getViewBuilder('block_content')->view($block);
    $variables['page']['content_right']['custom_block'] = $block_view;
  }
}

What am I missing?


texts: How do I add an image to a block in Drupal 7?

texts: I want to add an image to a block located in the First Sidebar in Drupal 7. Does anyone know how to do this? Thank you.


texts: Render a Views row ID using NID (Node ID)

texts:
I can easily add NID (Node ID) as a field in my view and then render it as a class for the Views Row using replacement patterns for the row class of an unformatted typical view. (See screen capture).

However, I'd like to render the NID as an ID for each row for use for some special theming I am doing. If I use devel themer, I see my template is views-view-unformatted.tpl.php so I can of course copy this template into my theme's template folder with a custom name specific to my view and then theme it.

The relevant line of code in the template that renders the row class is:

  <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>

If I change it to:

<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>
    id="<?php print $fields['nid']->content ?>">

...However, this does not work as I don't think fields are available at this level in the views row.

So essentially right now my rendered output is:

... when I'd like it to be

My question, is there a way to just render the associated NID where I want it as an id other then the method I am trying to use?


texts: Can I force users to join a group when registering?

texts:
I would like everyone to be a member of "our Community" by default.
I want everyone to be a member of a site-wide group so that we can have a site-wide wiki, events & all the other usual group stuff.

Do I miss the point? Is this already the case, or do I not really want what I think that I want?


texts: How do I store the values submitted in a form in the session?

texts: I want to submit a form and store the submitted values in the session. In Drupal 7 I just used $_SESSION['key'] = $value; but how do I correctly implement this in Drupal 8?


texts:
I tried following methods for search index in drupal 7:

Click on re-index site.
Number of items to index per cron run is 100.
Save Configration.
Run Cron and check the items count left to index.

I got "There are no new nodes. Cron run successfully." still I am getting (0% of the site has been indexed. There are 51996 items left to index) in index status.


texts:
The emails generated by contact forms I have made are full of these before the content of each field:

Any ideas why this should be? It is on every field.


texts: How to bulk update existing path alias after changing the URL alias pattern?

texts:
How to bulk update existing URL alias?

I have Path auto module add path alias to URLs. I have changed the URL alias pattern. Now I want to update the pattern of old URLs also.

How can I achieve this?