texts: How to override authenticated user permissions?

texts:
I'm looking after an intranet site on D7.
Our system daily gets a user feed from active directory and puts everyone (new/existing users) as authenticated User. Authenticated users have the permission to comment on nodes. Is there any way I can create a role which override authenticated role permissions so if I want to ban a user of writing comments/creating nodes etc...


texts: Alternative to .htaccess compression with Boost

texts:
My hosting provider doesn't support mod_deflate directives in .htaccess to provide compressed HTTP responses.

I am using Drupal 7 with Boost and wish to compress HTML, CSS and JS responses.

Is there another alternative to doing this with .htaccess?


texts: how to add credits each month with rules?

texts: How do I add commerce credits to a specific type of user the first in every month? I cant seem to find a date field in rules-->add rule-->events


texts: taxonomy view only works with un-aliased paths

texts:
I've created a custom view to display my taxonomies. With URL alias (pathauto) setup on the taxonomy/term/% path I would expect that the aliased url would display my view. Instead I get a blank page.

If I browse to the un-aliased path ie /taxonomy/term/15/ it all works. Any ideas why this happens? I've seen the Path redirect module, Sub-pathauto module, and Global Redirect module, but i'm pretty sure this should just work without any other modules. Apart from that I don't want to take my changes with yet another module, so close before my deadline ;)


texts: Some of the user profile fields on registration page not showing in user edit page

texts:
I have customized user profile edit page as page-user-edit.tpl.php in drupal 6 and created custom fields in user profiles like COMPANY SIZE with radio buttons, NO OF EMPLOYEES  etc.

It is configured to display these field during registration based on role. It works well. My problem is these fields are not being displayed on user edit page (user/*/edit). Is there any way i can display the fields on user edit page to update values.

Here is my code on page-user-edit.tpl.php

<?php if(arg(0) == 'user' && arg(3) == 'profile' && arg(1) != '0' && trim($user->roles[3]) == 'Corporate Profile'  ){ ?>

<?php print $help; ?> <?php print_r($content); ?>

<?php } ?>


texts: How to theme a link in a D7 render array?

texts:
I'm trying this:

        $content[] = array(
          '#theme' => 'link',
          '#text' => $row->title,
          '#path' => $base_path . 'node/' . $row->nid,
          '#attributes' => array('attributes' => array('title' => $row->title)),
          '#prefix' => '<h3>',
          '#suffix' => '</h3>',
        );

but Drupal is complaining that "Arg 1 passed to drupal_attributes() must be an array, null given" My array looks fine? ...or does it xD

Here is the API doc I'm looking at


texts: How can I override a module-defined view and export to code?

texts: I'm using nrembrowser to provide a media library and allow users to insert media via a wysiwyg interface. The module provides its own view which I've altered. I keep my views in code (using features) but I don't know any way to override an existing module-defined view via code (ie something similar to strongarm, but instead of overriding a variable, it's overriding a view). I've solved the problem by using a nrembrowser hook to change the view to my custom one, but I'd be interested in knowing if I could've overridden the module's default view in some way.


texts: Is there a way to have a persistent audio player between page navigations? HOw do you prevent the player from restarting on a page refresh.


texts: Create an autopath or a token using entity reference of entity reference

texts:
I have created a new node type "station". This node type has an entity reference to another node type "location", which in turn has an entity reference to a node type "prefecture".

I would be interested to have an autopath for the station, which would be of the form
http://www.website.com/[prefecture:name]/[station:name]

The problem is that prefecture:name does not appear in the tokens for node 'station'. Any idea how to go further with this?


texts: Create a view of nodes based on user record

texts:
In Drupal 7, I have a Content Type, let's call it fruit. I have added an entity reference field to fruit to the user record. I want to create a view that lists all the fruit, but puts a mark next to those that have been ticked on their user record.

I am unable to work out how to do this, principally because I can't see how to add a Relationship to the user record.

Any help would be appreciated.


texts:
I've created a module so users can insert a link.

When users will insert their link, i wish to add a suffix to the link.

For exemple : they will add a link > "www.test.com"

I want to be able to add to the link once they hit save "http://"

So the link will be http://www.test.com

When i do :

$form['attributes']['href']['#prefix'] = 'prefix';

I get :

What's the best way to do it without using $form['attributes']['href']['#default_value']

Many thanks,


texts: What is the proper condition to check for a select list value of none?

texts:
I have a rule in drupal that populates an entity reference in a parent node with a child node.

Then I created a new rule that is applied "before content is saved" that will remove the child node from the old parent node if one wants to move it to a different parent node.

And it works as expected UNLESS one chooses -none- in the select list. How do I make it remove the child reference when none is selected. I tried Data value is empty and that doesn't work.

Here is an export of my current rule:

{ "rules_remove_job_from_client" : {
"LABEL" : "Remove Job From Client",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_presave--job" : { "bundle" : "job" } },
"IF" : [
  { "NOT data_is" : {
      "data" : [ "node-unchanged:field-client" ],
      "value" : [ "node:field-client" ]
    }
  },
  { "node_is_of_type" : {
      "node" : [ "node:field-client" ],
      "type" : { "value" : { "clients" : "clients" } }
    }
  }
],
"DO" : [
  { "list_remove" : {
      "list" : [ "node-unchanged:field-client:field-all-jobs" ],
      "item" : [ "node-unchanged" ]
    }
  },
  { "drupal_message" : { "message" : "Is this firing" } }
]
}
}


texts: How do I override a module template (.tpl.php) from my custom subtheme?

texts:
I've seen how to override module templates from other modules and theme templates from subthemes, but how do I override module from subtheme? The file is under the profiles folder.

Edit:

I'm using Open Atrium. I want to override this file:

  /var/www/openatrium/profiles/openatrium/modules/apps/oa_home/oa-home-default.tpl.php

From my subthem wich is located at:

  /var/www/openatrium/sites/all/themes/my_radix/

The subtheme is working fine, but I need to override some .tpl.php files that are not part of the parent theme. How can I do that? Where do I copy them? How do I tell Drupal to use the new files?


texts: How can I display a custom field for node reference in another content type?

texts:
I have a node with custom fields that I would like to pull into a different content type. I do not want to display the full node, only one or two fields. Currently with Node Reference I only have options to display the title, ID, or the full node.

My content type has the option to list unlimited nodes of this type, so the end result could possibly have multiple node ids.

I think the best way to do this would be with a custom ph formatter but I am a little lost on how to make it work.


texts: How to find a field name/column name of a field in database where I have only the label of that field?

texts:
I am working on an integration part with drupal framework. Here it's hard to  find the table names of the field which is present in the view as I know only the field label name.

Is there any way to sort this out?


texts: How to access $variables in a module function where $variables is not passed to it. (D7)

texts:
I have a custom module that retrieves a view.

I would like to set a page variable that sums up a bunch of fields as im iterating through them.

So how to i access the $variables variable if it isnt an argument of my function?


texts:
Using Drupal 6, Views 3. I am trying to build a view that will include events for the current school year. So this year the view would include everything from September 2014 through June 2015. Once we got to July 1st 2015 the view would show the next year (Sept 2015 - June 2016).

I'm thinking this might be accomplished with arguments but I'm not sure.

Any kick in the right direction would be greatly appreciated.

Les Z


texts: Rules: get content created by user account being cancelled?

texts:
Case: using Rules module, when a user account is cancelled, create a new node of type Archive and (a) copy select data from that account to the new node of type Archive, and (b) copy select data from a single node of type XYZ authored by the cancelled user to the new node of type Archive.

I have this rule:

EVENT
After a user account has been deleted
CONDITIONS
None
ACTIONS
Create a new entity
(set data values here)
Save entity

In Actions, the new node created is of type Archive. In between creating and saving this new node, data values are set (i.e. "Set data value") on it. The values are derived from the account being cancelled.

However, how can I access a node of type XYZ authored by this account, and use that to also set data values on the new node of type Archive? There seems to be no way to access the fields of XYZ in the Data Selector. The available fields pertain only to the account, and not to content authored by that account.

As a comparison, in Views I would establish a Relationship to open up access to fields of related entities. What's the equivalent in Rules?

Thanks


texts:
In the Default installation of Open Atrium, Under the navigation bar, on the right side you will see User Badge. For Anonymous user it shows Login text with link and for the authenticated user it shows Username text with image and link and sub menu shows Dashboard, Edit Profile & Logout (all with their associated links respectively).

I want to customize the user badge when user is logged in. I want to add/delete option under the drop-down. Is there any ways to do so?


texts: Fix a constant width for first sidebar and second sidebar

texts:
I'm working on Zero point Theme in drupal 7. In my home page I've three blocks - first sidebar, content and second sidebar formatted as three columns. Here the width of first sidebar and second sidebar are equal and the content has its own width (I'm ok with that). There are some pages where I have only first sidebar and content.

Previously, I was facing a problem like if I go to other pages(other than home-page) the first sidebar's width will be increased. I don't like the view so I changed the CSS.

I gave a fixed width to the blocks by editing the CSS -

.block.themed-block{
                    width: 60%;
                   }

Now, the first sidebar and second sidebar has constant width in all pages.

My Issue is : when I go to other pages where I have only first sidebar and content page, the width of the first sidebar is reduced and the content part doesn't appear from where the first sidebar ends, it leaves some space between the first sidebar and the content part. It shows some odd effect. I want the content part to start from where the first sidebar ends. Is there any way to get rid of that.

Below, I share the screenshot of my Issue.

Highlighted rectangle part is the space, that I want to get rid of.


texts: How to get html source code from body field in node type edit form?

texts:
In node type = "article", I have field of type body.

In my .module file, I want to get its raw source code with actual html classes too. But all I get is:

$body = $node->get('field_all_body')->value;
print_r($body);die;

I want the value should contain div class too. How it can be achieved?
My actual requirement is:
I want to populate one field value on behalf of the class exists in 'field_all_body' field.
Foe example, I select some text in text-editor, and mark it bold, then that particular text should get cloned in another field too.


texts: CKEditor - how to tailor it to one's needs?

texts:
I'm using a demo version of CK Editor. While it does what it is meant to, I find several annoyances I thought you guys might have found a way to overcome.
What hurts:

The output code quite messy. It prepends the text with empty
<p>&nbsp;</p> lines which are not rendered initially, not until
you toggle Source code back and forth. (The line break treatment
setting does not seem to matter here)
The output code is very white-spacey (too many tabs indents and line-breaks)
The module itself seems not too much configurable (default format "Normal DIV" being useless in most of my cases - but I cannot set other default).
It unnecessarily converts some of the HTML-safe characters into entities (such as &oacute;) while leaving out others not necessarily HTML-safe (like Eastern European accented characters, the equivalent of &deg; or Greek symbols).

On the whole, operating it requires very much clicking, toggling, proofing and using support tools like Dreamweaver or NetBeans.

But this is the out-of-the-box state. Perhaps someone has managed to tailor the editor and its behaviors to their needs, via js or whatever it supports and can shed the light on how to do that?


texts: Render block programmatically in Drupal 8 returns 0

texts:
I create a block at /admin/structure/block/block-content and I want programmatically render it in our custom template files. What I did is

function hook_preprocess_page(&$vars) {

    $block = \Drupal\block_content\Entity\BlockContent::load(2);
    $vars['contact-us-info-block']= \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);
    //kint( ($vars['contact-us-info-block']));
    //kint( drupal_render($vars['contact-us-info-block']));
}

and in page template file I try

<p>{{ contact-us-info-block }} </p>

but I only see a "0" in output.

if I use

$vars['contact-us-info-block'] = drupal_render($vars['contact-us-info-block']);

everything is Ok but I find out drupal_render is deprecated in Drupal 8.
Where is problem and how can I render a block at page template programmatically?


texts: restrict visiting user/1 path for all users except admin

texts:
I would like to add a condition that users are not able to visit admin profile using user/1 in url. (not even if url contains alias).
What would be the easiest way of doing that? I do not want to install additional module just for this task. Thank you.


texts: Migrating to the webserver - what do I have to take care for?

texts:
What do I have to keep in mind? What do I have to take care for - especially if I have troubles with

file ownership
permissions

If I set up a drupal-commons version 6.25 locally on my machine at home - which is a openSuse 12.1 - everything runs nice. All goes smoothly.
especially if I want to upload files - no problem here.
But if I want to do the same - uploading pictures - on the version that I either installed directly on the webserver or ported over to the webserver I have terrible issues.
It is not possible to upload any file - I have troubles and get error messages....
regarding the temp-directory (which is complained to be missing)
regarding the permissions on site/default/files
Well some words regarding the server and the circumstances and conditions it runs with: my serveradmin works with the setgit bit
I run a linux sever that is administered by a friend of me. He prepares the chown and permissions - with the setgit-bit to on. See the issues with the server described more detailed here
on a sitenote:
Well the trouble is that i get lost the setgitbit every time when I touch the permissions with FileZilla.
That is the terrible issue! Note - at the moment I do not have a access to the server wit WinSCP - WinSCP can set the Setgit. FileZilla cannot do this at all!
The question is: what do I have to take care for if porting over Drupal. Both versions:
.a a Drupal commons version 6.25 and
.b a Drupal version 7.12
Do I have to set up a tmp directory again? Note: if I create the whole installation here on my local server then my assumption is, that all things have been done properly.
What experience do you have - what do I have to take care for?
I love to see a fruitful discussion.


texts: Product image is not shown in View Mode Node:Product List

texts:
I'm starting with Commerce Kickstart 2 together with demo store.

I added a product and upload one image, this product has one of the demo store variation types (Bags & Cases) and the product display type associated.

It seems simple since I didn't change nothing. But when I click in main menu the products already there are listed fine, with product image, only my new product don't show the image.

I see in variation types Bags & Cases that the Images field, Column Format, is defined as image delta, Image style: product_medium. And that is the point. In MySite/sites/default/files/styles directory are the styles of images. In that directory there is the product_medium directory where the images showed when in View Mode Node:Product list (the list of bags listed when click in To carry).

Well, the fact is when I create the product there is no option to load an image that will saved in MySite/sites/default/files/styles/product_medium directory. And that's the problem. Since when I manually copy the image to that directory, the image is showed up.

Where I define this product_medium image?


texts: How can I prevent anonymous users from accessing taxonomy pages?

texts:
I would like to prevent anonymous users from accessing any of the taxonomy pages on my site.

I am already using the Panels module to provide variants for each vocabulary, and these variants have access rules limiting them to authenticated users only.  However, anonymous users can still access the default taxonomy pages provided by Drupal.

I thought about adding a new variant (301 redirect) and forcing anonymous users to the front page-- is there a better solution?


texts:
Here drupal have a field for set a description for each images:

How I can add a custom field for each image please ?
By example a "Title" or "Author" field ?
Thanks.


texts: Geofield (geocode from another field) - database entry not created

texts:
On a Drupal 7.63 site, I have a content type with a "Postal Address" field (address module, v7.x-1.3) (mandatory) and a "Geofield" field (geofield module, v7.x-2.4). The geofield field has no input interface: it uses the "Geocode from another field" widget and is configured to use the Postal Address field as a source. Its information is then used to render a small map using Google Map ("Geofield map").

My issue is that when creating new nodes, the geofield field remains empty and no map is rendered. And when updating the address on existing nodes, the map isn't updated (it still shows the old point).

I checked directly in the database (table field_data_field_geofield), and can confirm that the rows corresponding to the new nodes are not there. So it seems the data is never created in the table, but I don't know why.

I see no error message on the edit page of the nodes or in the recent log page (admin/reports/dblog).

The addresses used for those nodes are correctly formed and stored (I checked the field_data_field_adresse table); they are rather simple and can easily be found on Google Maps. (Example: Grand-Rue 5, 2900, Porrentruy, Switzerland)

I tried applying the patch provided in this issue, but it didn't solve my problem, even when creating new content (I have since rolled back this change). Maybe it's not the same problem.

Update: after more research, this issue seems to describe my problem. However:

applying patch #29 doesn't solve the problem
applying patch #41 doesn't solve the problem
downgrading geocoder to v.1.3 doesn't solve the problem either.

Any suggestion on what is wrong would be greatly appreciated. What else should I check for?

(It's on a website that has used this system for several years and it's the first time I see this problem.)

(I created a request support ticket on the geofield page last week, but so far I haven't received any feedback.)


texts: SQL select data from more than one table

texts:
I've constructed a nice query in drupal 7:

SELECT og.label AS title, og.gid AS gid
FROM og
LEFT JOIN field_data_field_group_category
  ON og.etid = field_data_field_group_category.entity_id
WHERE ( (field_data_field_group_category.field_group_category_value IN  ('1')) )
ORDER BY title ASC

This works but actually I want to remove the WHERE clause and instead put field_data_field_group_cat.field_group_category_value in my result. But when I try:

SELECT og.label AS title
  , og.gid AS gid
  field_data_field_group_category.field_group_category_value AS cat
FROM  og, field_data_field_group_category
LEFT JOIN field_data_field_group_category
  ON og.etid = field_data_field_group_category.entity_id
ORDER BY title ASC

This won't work.. How do I get a value of another table in the result object?

Greetings!


texts:
I'm trying to make a little block that links to the logged-in user's profile. I've already created a view block with the necessary information, but I don't know how to make it clickable and link it to the user's profile.

How can I achieve this?

Edit: One can find some more details about the code that fixed this problem at https://stackoverflow.com/questions/23552893/how-to-create-a-clickable-block.


texts: Customise message notifications in Drupal 7

texts:
I'm using organic groups with Drupal 7 and members receive email notifications when new content is posted to their group.

However I can't find a way to modify:

Email subject: New post in group
Email message: Hello [user], There is a new post called...

Which template or database entry do I need to modify?


texts: Using a template_preprocess_node in an adaptive subtheme

texts:
I'm using the adaptive theme with the pixture_reloaded subtheme, and I'm trying to place a preprocess to change the format of $date. This is what I thought should do the trick but haven't had any luck with getting the output I want.

In ./sites/all/themes/adaptivetheme/adaptivetheme_subtheme/template.php, I've entered the following:

function adaptivetheme_subtheme_preprocess_node (&$vars)
{
   $vars['date'] = format_date($node->changed);
}

In ./sites/all/themes/adaptivetheme/adaptivetheme/templates/page.tpl.php, I've added:

print $date;

under the location where the main content is rendered.

The date prints where I want it to, however, the date format is still showing up as the date which the content was created, and not the updated date. I've edited the content multiple times as well.

Is my preprocess hook supposed to be placed into a different area to make this work?

Any help is much appreciated.


texts: MigrateSQLMap with multiple same-name source keys?

texts:
I'm using migrate module 7.x-2.5 with a MySQL source database. My records are defined by the intersection of two tables, so I need two keys in my $source_key parameter to MigrateSQLMap(). I've done this before, no problem. But in this case, the columns have the same name, both "id". Because the column name is used as the key in the $source_key  array, the second "id" would replace the first "id".

I tried defining an alias for one of the columns with addExpression() and using the alias (type_id) as one of the keys. This correctly registers multiple source keys and shows the correct record count on drush ms, but fails on drush mi with a SQL error: "Column not found: 1054 Unknown column 'type_id' in 'on clause'".

In the short term, I can just create a new column in one of the tables and duplicate the "id" values, but I'd like to know if there's a way to do this entirely in migrate code without altering the source database.


texts: Drupal 7 Search results have no theme or format (no HTML)

texts:
I have a Drupal 7 installation with about 10 custom types and a custom theme. I have a search form in the site's header displayed with

$block = module_invoke('search', 'block_view', 'form');
print render($block);

This code is in an include file called by my page.tpl.php, it's not actually inside a block.

If there are no search results, the search page displays (mostly) correctly and it uses the search-results.tpl.php template in my theme.

However, if there are search results, I get an unformatted page.  It's just the search results (with their associated HTML p tags, etc.) with no site HTML.  No head tag, no body tag and none of the custom theme's HTML.

By using advanced search, I have identified, specifically, that one of my custom types is causing this issue.  The confusing thing is that this type just has a title and a body text.  Other, more complicated types are not causing this issue.  When I limit it by type, I get the correct output.

How can I get the search results to show up on a regularly themed page?

EDIT

I have also tried:

echo drupal_render(drupal_get_form('search_form'));


texts: I am able to get content of articles with rest calls. I want to make module, with statistics, what article was read the most. (read = by rest calls...not by views on page). Thanks.


texts: Why are cck fields included in body when getting a node?

texts:
I have a content type that has several CCK fields: date, session number, session type, sold out, and homepage eligibility. The values of the fields are in no way stored in the body of the node as far as the database is concerned; here's the contents of the body field from one node in the node_revisions table:

The word &ldquo;insight&rdquo; is one of the most misunderstood and misused words in the marketing world today, but it is also one of the most important. As consumers become more fragmented and individualized, they will increasingly look for brands that represent some aspect of who they are. Brands will have to understand their target from an insights perspective. It will no longer be sufficient to settle for target generalizations.

In this seminar participants will take his/her knowledge and application of insights to an entirely new level. This seminar will teach attendees how to:

Identify real insights and distinguish them from generalizations, significantly improving the quality of an organization&rsquo;s insights.

&ldquo;Craft&rdquo; (rather than just articulate) an insight so it is evocative, breathing life into creative briefs/documents so they inspire.

Connect a shopper insight to a corresponding consumer insight (insight connectivity): How does the life of the shopper outside of the store (the consumer&rsquo;s life) effect what they do in the store (the shopper&rsquo;s life)?

When I use the $content variable in a node template, though, the values of the CCK fields are printing as well. I did a print_r($node) to see what was happening, and this is what I get (some elements stripped out for brevity):

stdClass Object (
  [nid] => 383
  [status] => 1
  [created] => 1323794850
  [vid] => 383
  [title] => Advanced Consumer and Shopper Insights
  [body] =>

The word “insight” is one of the most misunderstood and misused words in the marketing world today, but it is also one of the most important. As consumers become more fragmented and individualized, they will increasingly look for brands that represent some aspect of who they are. Brands will have to understand their target from an insights perspective. It will no longer be sufficient to settle for target generalizations.

In this seminar participants will take his/her knowledge and application of insights to an entirely new level. This seminar will teach attendees how to:

    Identify real insights and distinguish them from generalizations, significantly improving the quality of an organization’s insights.
    “Craft” (rather than just articulate) an insight so it is evocative, breathing life into creative briefs/documents so they inspire.
    Connect a shopper insight to a corresponding consumer insight (insight connectivity): How does the life of the shopper outside of the store (the consumer’s life) effect what they do in the store (the shopper’s life)?

Date and Time:
April 16, 2012
Session Number:
S1
Session Type:
Advanced Learning Session
Sold Out:
Open
Homepage Eligibilty:
Yes)

The last chunk of the body element (starting with Date and Time) are all CCK field names and values. Why are they included as part of the body? And what can I do if I don't want them displaying?


texts: How to create a view displaying nodes posted in the logged-in user groups?

texts:
I can't figure out how to create a view listing all nodes from the logged-in user groups. This was easy with Drupal 6 version of Organic groups, but with the entity based version, it is not obvious (or maybe not doable without some views data hooks).

Thanks for your help.


texts: Add a print button on "review order" page of commerce

texts: Okay I'd like to know if there's a way to edit the "Order Review" page of a Commerce order and add a print button to it?


texts: How do I define this simple views relationship?

texts:
I have a person table that has a primary key id. This is a base table.
I have an address table that has a foreign key person_id. This is NOT a base table (has no primary key)
The address table contains a person's address, but not every person has an address.

When describing these two tables to views, how do I set it up so that when the person table is used as a base table, I can optionally add a relationship to address to join in the information?

I know I can add an implicit join on the address definition like so:

$data['address']['table']['join'] = array(
  'person' => array(
    'field' => 'person_id',
    'left_field' => 'id',
  ),
);

This allows me to add any address fields automatically in the Views UI. Views would by default use a LEFT JOIN to bring in the address data. I can change this to an INNER JOIN in the above definition, but I want to allow the user to chose, which is exactly what using a relationship handler does (has the "require this relationship checkbox", which controls INNER vs LEFT).

However, in my analysis of how these handlers work, I don't think I can define the handler in a way that this will work. It seems the relationship handler should be added to the foreign key on the base table. My base table is person, which does not have the foreign key.

For instance, I tried this:

$data['address']['person_id']['relationship'] = array(
  'base' => 'person',
  'base field' => 'id',
  'handler' => 'views_handler_relationship',
  'label' => t('Address'),
  'help' => t("Has basic information on a person's address.")
);

But this doesn't work, since address is not used as a base table in my View.

How can I do this?

P.S. part of my confusion/trouble stem from my inability to define a table neither as a base table nor an implicit join table, which is what I want to do for address.

UPDATE 1: For a real-world example, look at the table accesslog and how it relates to users. When working with a view w/ users base table, you cannot explicitly add the accesslog relationship, but you can add all the accesslog fields since statistics.views.inc creates the implicit relationship. My schema is similar, but I want to use explicit relationships instead.


texts: Can't add contextual Filter (taxonomy term ID (with depth)) to a View (User)

texts:
please help me out here:

I can't find a contextual filter by taxonomy term with depth on a view of users and/or profiles. When I make a view of content it can be chosen.
I'd like to provide a filter for Regions, so Filter for Europe should result in a List of Users from all over Europe and so on.

The users are associated with a taxonomy term.

Thanks for your help or any suggestions.

Christian


texts: Is there a benefit to adding JS and CSS in preprocess_html instead of theme.info?

texts:
Most of my sites js and css is being added in theme_preprocess_html instead of using theme.info.

It doesn't seem like there is anything being applied there to prevent them from not loading in certain areas. I'm wondering if this in anyway affects caching performance or rendering performance.


texts: How to style Commerce Order Notification Mail?

texts:
I'm using the latest version of Commerce kickstart. For order notification I'm using the provided message type together with rules for triggering. Everything works fine and the mails are sent with intended content, but I don't now how to style the mails. I tried to copy mail.css into my theme directory and modified it with my custom styles, but without effect.

Thanks for your hints!


texts: I save form data using hook_form_alter() but the data don't appear when editing the node from the UI

texts:
I implemented hook_form_alter() to insert few fields. I implemented hook_node_insert() to save the field data, hook_node_load(), and hook_node_view().

Everything works fine, but when I edit the node, the edit form appears with no data.

How can I fix this?

function mymodule_form_ABC_node_form_alter(&$form, &$form_state, $form_id) {
  $options_first = _mymodule_get_first_dropdown_options();
  $selected = isset($form_state['values']['filed_1']) ? $form_state['values']['field_1'] : key($options_first);

  $form['field_1'] = array(
    // …
  );
  $form['field_2'] = array(
    // …
  );

  return $form;
}

/**
 * Implements hook_node_insert().
 */
function mymodule_node_insert($node) {
    db_insert('my_custom_table')
      ->fields(array('nid' => $node->nid, 'field_1' => $node->field_1, 'field_2' => $node->field_2,))
      ->execute();
}

/**
 * Implements hook_node_load().
 */
function mymodule_node_load($nodes, $types) {
  foreach ($nodes as $node) {
    $nids[] = $node->nid;
  }

  $result = db_select('custom_table', 'e')
    ->fields('e', array('nid', 'filed_1', 'field_2'))
    ->where('e.nid IN (:nids)', array(':nids' => $nids))
    ->execute();

  foreach ($result as $record) {
    $nodes[$record->nid]->field_1 = $record->field_1;
    $nodes[$record->nid]->field_2 = $record->field_2;
  }
}

/**
 * Implements hook_node_update().
 */
function mymodule_node_update($node) {
  if ($node->type == 'abc') {
    // Delete the existing values.
    db_delete('custom_table')
      ->condition('nid', $node->nid)
      ->execute();

    db_insert('custom_table')
      ->fields(array('nid' => $node->nid, 'field_1' => $node->field_1, 'field_2' => $node->field_2,))
      ->execute();
  }
}


texts: Private Message with node.js issues setting up

texts:
I have followed the suggested video tutorials https://www.youtube.com/watch?v=u1sxDaH3Z-U and https://www.youtube.com/watch?v=f8XAT1oB1eA

Im using the node.js watchdog submodule for debugging. That's what the tutorial video did. She didnt have any problems.

Any clues?

backendSettings = {
  "scheme":"http",
  "host":"localhost",
  "port":8989,
  "key":"/etc/nginx/ssl/SECURITY.key",
  "cert":"/etc/nginx/ssl/SECURITY.crt",
  "resource":"/socket.io",
  "publishUrl":"publish",
  "serviceKey":"",
  "backend":{
  "port":80,
  "host":"panduh420.com",
  "messagePath":"/nodejs/message"},
  "clientsCanWriteToChannels":true,
  "clientsCanWriteToClients":true,
  "extensions":"",
  "debug":false,
  "transports":["websocket",
  "polling"],
  "jsMinification":true,
  "jsEtag":true,
  "logLevel":1};


texts:
I used the Block Image module to create some content; now I want to give the site's editor the permission to translate the blocks, but I can't seem to find how I can do that. There's no permission to let a role be able to translate a block content.

How do I grant permissions for translating block content?


texts: How can I hide empty Quick Tab item when there is no content in it?

texts:
I don't want to show quicktab item when there is no content in it.
But I can see empty divs in it.

How Can I remove the quick tab for above empty content.


texts:
I installed domain-access module ,
 I want create some taxonomy and load it in one content type

I want show  per taxonomy only on same domain.

for example I have 2 vocabulary(Ubuntu and Arch)

if url is http://Ubuntu.project/node/add/ask . Ubuntu vocabulary is loaded,

else if url is http://Arch.project/node/add/ask . Arch vocabulary is loaded

please help me and thank you.


texts: requesting suggestions on using core poll module

texts:
I'm working in Drupal 6.22.I have a peculiar requirement with my poll module as below

Display the most recent poll block such that anonymous user could
vote in it.
Once the user has voted display the vote results block with link to all
previous polls page.
In all polls page again display the poll-vote block of the most recent poll
with links to previous polls.

I'm not expecting a contributed module that fits all my requirement in a tailor made fashion but wish to know if there's any module that would aid me in satisfying some portion or giving better ideas in implementing it. I did my search and found Poll Enhancements Module and Poll Improved Module which sound promising for D7 but are not quite there for D6.

Is there a better option of implementing this than arm twisting the poll module with coding?
If anyone could share their suggestions, ideas or experiences it would be nice...

Thanks in advance!


texts: How to define custom messages in Drupal 7

texts:
I want to show a custom message to user after he/she adds a new content of a specific type in Drupal 7. If I change the '@type %title has been created' to what I want the message will change for all content types.

How can I do it? Is there any module to define messages for different actions?


texts: Trying to find variable names from $user array

texts: I need to manually pull through user images and and users first name for a comment section, but i cant find what these array items are named, if anybody knows please tell me and or tell me how to find similar information in the future.


texts:
I want to use services 3 module to create node of a content type in my Drupal 6 website.
I have enabled Services 3 module and configured the Rest Server properly.
But when I make a post call to it, the browser converts the POST method into OPTIONS and hence the response that is received is http 411 error. Further more, there is an error in that console about Access-control-allow-origin. This clearly means that this is a CORS issue.
I searched for a way to enable CORS in Drupal 6 and found out that we can enable CORS by adding headers in the .htaccess file. I added the following lines to .htaccess file :

Header set Access-Control-Allow-Origin "*" env=IS_CORS
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Header add Access-Control-Allow-Headers "x-requested-with"

Is this the correct way to enable CORS in Drupal 6 site?
Thanks in advance. Please try to guide me through this. I am sure many people must have faced this situation, but I am currently not able to find  nice solution to this.


texts: add and remove preassign role to user on completion of user profile

texts:
I have created user through admin. Admin Assign specific role to user. But On first time login we want user to complete user profile and then only it will able to access anything else on site. So I want to remove role from user profile if any of field in user profile is empty. And add Pre-assign role again to user after completion of user profile.

Please help. Thanks in advance


texts: How to extend the basic user object upon installation?

texts:
I need to build a module to handle Users profiles, and need to extend automatically the basic Drupal user object upon installation.  For Drupal 7 I found a way with:

field_create_field($field);

But this function is not available in Drupal 8, BTW totally noob on Drupal, Learning while working on it.


texts: Why does composer remove a folder it doesn't manage

texts:
I have the gesso theme installed in themes/contrib, and since I have not subthemed, all my components and templates live in within its folders. For that reason, I do not manage it with composer.
I needed to install a contrib module, and when I ran composer require, the first thing it did was remove gesso.
Why would this happen, and is there a way to tell it "hands off" ?


texts:
whenever user creates content, I want to get the few fields data of content in the mail body and trigger mail,, as of now i have created rule to trigger mail with text comparison condition for specific field.

ex: I have content with user id, pancard Id fields etc,now i want to get this content field data in mail body and send mail to user.


texts: Issue with Access PHP array in display module

texts:
I am passing few parameters via ajax to custom module (fgs_api.module) and in returns getting JSON data ($results->data). I want to use/get that variable ($results->data) in node--xyz.tpl.php content template. How can I use that variable in node--xyz.tpl.php. I am doing in drupal 7.

In module fgs_api.module

function fgs_api_data_execute($parameter1, $parameter2)
{
    if(!is_null($parameter1) && !is_null($parameter2))
    {
        // my custom code which is working
         $results = $api->{'getSpecialOfferHomes'}(intval($parameter1), intval($parameter2));

        if($results->success)
        {
            $return = fgs_api_format_return(false, $results->data);
        }else{
            $return = fgs_api_format_return(true, $results->message);
        }
    }else{
        $return = fgs_api_format_return(true, 'Incorrect parameters');
    }
    return $return;
}

In Js

  var url = '/fgs_api_data_execute/' + parameter1 + '/' + parameter2;
                console.log(url);

                $.ajax({
                    url: url,
                    type: 'POST',
                    dataType: 'json',
                    success: function (result) {
                        if (result.data) {
                             console.log(result['data']);  // use this data in Module
                        }else {
                           console.log("error");
                        }
                    },

How can I use/pass return data variable from custom module to node--xyz.tpl.php?


texts: Views not respecting Contextual filter and Referenced Entity relationship

texts:
This is driving me crazy because it's so simple in Drupal 7.

Scenario:

Basic page has a entity referenced field where you can type in Spotlights that should be shown at the bottom of the page.

View:

Relationships (in order) is the field_spotlights (which exists on the Basic Page) and field_spotlight: Content using the previous relationship.

Contextual filter is the ID of the node, based on current id of page. Uses the field_spotlights relationship

Fields are the fields that exist in the spotlight, each with a relationship with field_spotlight: Content.

So the above should show only 3 results if the basic page is viewed and only has 3 spotlights in the entity referenced field.

However 4+ spotlights are showing, it's including the 3 that should show but then duplicates some or shows more.

UPDATE:

I've tried using Aggregation too, by adding a Content ID to the fields, and setting the aggregation setting to Count, Count Distinct, and Max/Min.

Also tried setting Distinct in the query settings.


texts: Multiple sites, each is either one page (with multiple editable content) or has multiple pages

texts:
I tried researching into this on google for a while, but I'm stuck.

Basically what I'm trying to do is this: I have a "big" main website.  Then, on the same drupal installation I want to have a "mini" site that will have a completely different theme, and only one page (but the page will have multiple editable content).  I also will have another site that will have a completely different theme, completely different navigation, and multiple pages.  Final piece that has me puzzled is that this will be on a subfolder basis.  By that I mean / will have the main site, /sitea will have the single page site, and /siteb will have the multipage site.

Any suggestions on how to handle this?


texts: How to save multi select value in list field in node programmatically

texts:
I need to programmatically save multi value in list text field in Node.
E.g.
 I am having multi select drop-down of language field, I am getting value in

$languages = array('English', 'French', 'English (UK)')

I need to save in node :

$node->field_languages[$node->language] = array();

foreach ($languages as $language){

    $node->field_languages[$node->language][]['value'] = strtolower($language);

}

$node = node_submit($node); // Prepare node for saving

node_save($node);

Please help me out, How to save multi select value in list field.


texts: How to redirect to frontpage when a node is deleted?

texts:
In my client's site it is normal to delete some posts (or old posts), but I don't want a 404 error page. Instead I want the user/visitor to be redirected to the frontpage with a 301 error code.

I have installed the Redirect module, but I have not found any option for this.

I have the Rules module installed and I can create custom module rule if I need.


texts: Can I get the Node's content type in hook_flag_alter

texts:
In the following code, I'm changing a flag with a short title of "Follow" to include the name of Content Type. Is it possible to add the content type so that I can not say Follow node but perhaps Follow Question, Follow Person, FOllow Group?

function hook_flag_alter(&$flag) {

    //node, taxonomy_term, user,  comment
    $extra_text_of_type = "";
    switch ($flag->content_type) {
      case 'node':
        $extra_text_of_type = "node";
        break;
      default:
    }

    $flag->flag_short = $flag->flag_short . ' ' . $extra_text_of_type;
  }


texts:
I created a custom block and I was trying to use the ajax method of jQuery, but it seems that whenever I access the method of the controller, it returns a 403 error.

This is my contoller (custom_blocks/src/Controller/CustomBlocksController.php)

namespace Drupal\custom_blocks\Controller;
use Drupal\Core\Controller\ControllerBase;

class CustomBlocksController extends ControllerBase
{
  // $variable is the wildcard from the route
  public function ajaxCallback($variable)
  {
    return ucwords($variable);
  }
}

This is my routing file (custom_blocks/custom_blocks.routing.yml).

my.route:
  path: '/sample-page/{variable}'
  _defaults:
    _controller: 'Drupal\custom_blocks\Controller\CustomBlocksController::ajaxCallback'
    _permission: 'access content'
    _access: 'TRUE'

This is my custom JavaScript code (custom_blocks/js/command.js).

(function($, Drupal) {
     $('#custom-button').click(function(){
        var name = 'john doe';
        $.ajax({
             type : "POST",
             url: '/sample-page/' + name,
             success : function(response){
                  console.log(response);
             },
        }, 'html');
     });
})(jQuery, Drupal);

Hope someone can help me.


texts: I have a number of fields added to multiple content types. Using the Field validation module takes much time, so I decided to validate them programmatically. Which hook should I use to validate fields?


texts: Node Automatically Scrolls to Comments on Load

texts:
For some reason, one of my content types scrolls to the comments section of the node every time it loads (instead of starting you at the top of the page). Disabling comments for that node solves the issue, so I know it has to be something to do with the comments. The weird thing is that none of the other content types have this issue - only one. Any ideas??

Edit:
With further testing, hiding the form elements in the comments area seems to solve the issue (setting .box form to display:none). However this is not ideal, as there is no way to post comments then.


texts: Add link that performs database function

texts:
I am building a tableselect. What I want is to have last row be a link that when clicked performs a CRUD using the row ID as input. The goal is to have a "delete" link that removes that row from the database. Or an add link that does the reverse.

I am looking at the example of the admin/content, which creates links like I need at the end of its table. But because this works on Nodes and I am working on database rows (in a custom table), this doesn't seem to really apply.

Are there any good tutorials/examples on something like this. I've found a few that helped me create the table, but this functionality I can't seem to find.

EDIT: And after reading through my own question again, I realized the business logic here wouldn't work... sorry for getting ahead of myself.


texts: How do I add a node ID as class to the  tag?

texts:
In Drupal 7, there is a class like path-node-NID (with NID replaced by the node ID of the node being viewed) added to the <body> tag so we can easily add CSS styles to specific nodes. This is missing in Drupal 8.

How can I add the node ID as CSS class to the <body> tag?


texts: How can I set the view mode of a node through rules

texts:
I'd like to change the view mode of a node based on the role of a user and another flag in the node, and by using the Rules module.

Since a call to display the node by default is full content, I wrote a rule that on Content is Viewed for that node type, it then checks the conditions and sets data value view-mode to teaser.

However, even when the conditions are met properly the node still displays full text.

From this I am assuming that Content is Viewed is being executed after rendering or am I missing something in my approach?


texts:
I would like to have some sort of management system in the control panel where the management people can view the activity of the authors during a certain period.

So: A person with a certain role (management) must have a management tab in his administration menu where he can see the names of all authors + their amount of articles they have created during a certain period, where the manager can choose the start and enddate of this period.

Example:

Manager chooses:

1 september 2015 - 30 september 2015

and then he gets an overview of all authors and their amount of articles made that month.

Is there a module by any chance that already has this?


texts: Is there an Authcache load event for fragments?

texts:
I would like to create a callback javascript function to fire when one of my Authcache fragments is loaded via AJAX. Is there a way to hook into this event?

Thanks.


texts:
I am pasting the following code into the text editor.

ABC

After the initial save everything looks fine in preview mode. However, if I go back in to edit the page, the styles applied to ul and li tags get stripped out, and the source looks like this.

ABC

How do I prevent this from happening?


texts: drupal  shows empty content because of memcache

texts:
I have a Drupal (pressflow 6.22) website and I am using memcache as a caching level for my website/server. Sometimes some node (articles) that has been published on my website shows empty content when browsed (Specially with IE).

When I do below on the server that has memcache

$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
flush_all
OK
quit

and refresh the page using the same browser, it is displayed properly. Has anybody faced the same issue?


texts: Generate new password for users periodically and notify user of new password

texts:
I am running a private Drupal 7 site where all user accounts are created by admins and managers. I need to ensure that all users have access to the email account that their accounts were created with.

What is the best way to do the following:

Create a user account with an automatically generated password, and notify the new user of their password via email.
After a 4 week period, a new password must be generated for the user and set as their active password automatically. The user needs to be notified of their newly updated password via email, and the newly generated password must be used to access the site until it is reset again.

Are there any Drupal 7 modules that can help achieve this?

Any suggestions on building a custom module that can help resolve this?


texts: How to modify the image output for just one content type?

texts:
We are using a field_image field across multiple content types. For the basic content type (only) we want to lazy load the images as such it requires the following  format. How can this be done for just basic content type?

Current output:

Desired output:


texts: No access to admin page after change my server and domain

texts:
I have changed my website to a new domain and server. I can navigate throught my content. However, after login I can't access to admin pages. No error is shown, only blank page.

What I did was upload a new .htaccess, delete the cache tables, uncomment on settings.php the line "Base URL (optional)". $base_url (replacing example.com with my site).

I don't know what can I do. Any idea please?


texts: How to have only unique values in a View

texts:
I created a view that lists all comments on a particular node (This was achieved using the contextual filters).

I send notifications to users on the list when a comment is added to the node.

The issue is that for users that have made more than one (1) comment to the node, they get multiple notifications.

My question is that is there a way to ensure that each user appears only once in my view, irrespective of the number of times they make a comment to a node.

Thank you.


texts: How to restrict Drupal commerce Shipping only for two provinces

texts:
we have a drupal commerece site http://floristerianoe.com, that need only to deliver (commerce shipping) in Madrid and Guadalajara (only two privinces in Spain) and we can´t find the option to do this, we only find the option to restrict contry, but we need this for province or city.
Thanks in advence.


texts:
I have created view and I have added the fields like entity reference fields followed by content fields, then I added the entity reference field in filter condition, but its not displaying the table data.
Following methods I followed to create the filter conditions,

1] created new view added the entity reference and other content fields.

2]added the contextual filters as shown in screen attachment, also the relationship as entity reference of the field.

3]in the left view page-> clicked on ->add filter condition->chosen the field and relationship but still its not able to filter the data of table please help me on this.thanks in advance


texts: How to import facebook and google users from expression engine 1.7 to hybridauth?

texts:
Is there any way to import facebook and google users from expression engine to hybridauth?

I am trying to get users in Drupal 7 environment. Normal users I got from the feeds module, but I didn't find anything for Facebook and Google logged in users.


texts: Are there alternatives for striptags filter?

texts:
When printing a text field we just want to display the value. When printed as is in a twig template ({{ content.field_subtitle }}) we get the following output.

Currently we are attempting not to use the |raw filter so we are just using {{ content.field_subtitle|render|striptags }}.

Are there alternatives to this approach without having to create another twig template for the field? We are having a hard time finding an alternative.

Setup:

Basic page content type has field field_subtitle where type is text(plain)
no twig template has been created on the field, only the content type node--page.html.twig

Current setup in twig template

  {{ content.field_subtitle|render|striptags }}

Current output:

Intrinsicly harness interactive functionalities.

Desired output:

  Intrinsicly harness interactive functionalities


texts: Best place to include javascript in a field formatter?

texts:
I've created a custom field formatter using hook_field_formatter_info() and implemented it using hook_field_formatter_view().

My formatter requires additional javascript though and at the moment I'm including it in hook_field_formatter_view() but I have a feeling there's gotta be a better place to do this.

However there is no hook_field_formatter_preprocess() (there is a formatter_prepare_view() though but it doesnt't seem right)

Any ideas?


texts:
Since the Documentation for Views 3.0 isn't out yet, does that mean that the way you access field variables is different from Views 2.0? That's because whenever I try the following code (from Views 2.0 docs: http://drupal.org/node/352970), all I get are errors:

<?php
    dsm(array_keys($fields));

    //ERROR message after placing it in views-view.tpl.php:
    Notice: Undefined variable: fields in include() (line 33 of D:\xampp\htdocs\foo\sites\all\themes\foofoo\views\views-view.tpl.php).
    Warning: array_keys() expects parameter 1 to be array, null given in include() (line 33 of D:\xampp\htdocs\foo\sites\all\themes\foofoo\views\views-view.tpl.php).
?>

In my modules I have Devel and Theme Developer enabled so why isnt it working? I also rescan my template files like a boss and clear my cache like a disease but still nothing.


texts: How do I add more pages to views pagination on mobile?

texts:
I'm using Open Social and I want to add more pages to the paginationon mobile phones.

One of my views has 11 pages of users and on mobile the pagination is as the following example (<< = previous page, >> = next page):

<< 5 >>

Now what I want to achieve is the following:

<< 3 4 5 6 7 >>

Now I have searched through all the settings but I can't seem to find where to change this. I believe it should be in the code but no luck so far either. Can anyone push me in the right direction?


texts: What is the best way to restrict website's direct access through node urls?

texts:
How can I prevent a node from being accessible on its own page, through node/xxx, but still be accessible through node description eg: /homepage?

I tried using the Rabbit Hole module, which restricted the page access through nodes/xxx. But it is restricting access even through the node's descriptive path. I don't want people having some knowledge of Drupal to play around with the website by typing in node-IDs.

So what is the best way to achieve this?


texts: What is the best way to alter field output? I found "hook_field_formatter_view" but seems nothing like "hook_field_formatter_view_alter" exists. In my case I have address fields (Addressfield module) which used in "Shipping" and "Billing" panes on DrupalCommerce's checkout page. I want to add some js to these fields, preferable using Drupal's Form API "#attached"


texts: Can we make 2nd field required only if 1st field is filled in a custom composite field?

texts:
I am using custom composite field in one of my webform form . It has 4 fields and i want to make 2nd field as required only if 1st field is filled .How can i do this?

I had added field2 as required in webform and I had tried to do remove the required attribute from field2  if field1 is not filld by  using some jQuery code but that is not working.

Below is the jQuery  code i had used

var field1=$('#field1').val();

if (field1 == "") {
 $('#field1').removeAttr('required aria-required aria-invalid');
 $('#field2').removeClass('required error');
}


texts:
I'm running Drupal from a subdirectory, not the root. Everytime I move my css files from my /test subdirectory to /live the urls in the stylesheet have to be changed. For example:

background-image: url(/test/sites/all...

has to be renamed

background-image: url(/live/sites/all...

Is there a setting, or something, that can inform Drupal of the base path for my css files?

Thanks.


texts: Can I make a page view with a contextual filter use AJAX?

texts: I have a Drupal 7 view that uses an attachment to present a list of links to taxonomy terms, and use that to drive a page view, filtered on the term ID. The links in the attachment causes the page to reload. What I'd really like is a way to the page to redisplay the content when a different attachment link is clicked, without refreshing the entire page. Is there a way to use AJAX to do this?


texts: How to add separator field to user profile

texts:
I'm creating new fields for the user profile.

I have this:

Company Name
City
Logo
etc

I need to add a new field or some kind of header/separator with this "CONTACT INFORMATION"

and then a bunch of other fields

Name
Email
Address

Basically I need to divide the fields by sections, I just need it to be visible, no programming purposes.


texts: I have multiple sites running on a single code base in Drupal 8. Is there any possible way to add different robots.txt file for each site?


texts: Drupal 7 hook_form_alter and submitting the form

texts:
I added some custom field so that i can get more information when someone registers into the website but i want to alter one field on the form. I created a module which has a hook_form_alter function so that i can alter the field_first_name of the registration form. here is the code

function user_registration_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'user_register_form'){

    $form['field_first_name'] = array(
        '#type' => 'textfield',
        '#title' => t('First Name'),
        '#description' => t('Enter your first name.'),
        '#maxlength' => 255,
        '#required' => TRUE,
        );

}
if (isset($form['actions']['submit'])) {
 $form['actions']['submit']['#submit'][] ='user_registration_form_submit';
   }

}

I also created a the function which handles the form submission.

function user_registration_form_submit(&$form, &$form_state)
{

$fe_id = db_insert('field_revision_field_first_name')
    ->fields(array(
        'field_first_name_value' => $form_state['value']['field_first_name'],
        ))->execute();
    drupal_set_message(t('your form entry has been added'));
}

My problem is that when i submit the form and i check the user details. i find that the first name details does not exist in the database or when i login as the administrator and click on the 'people' link. i find that all information is are submitted except the first name field which i am trying to alter. I also tried to submit the form without the form submit function but it still doesn't work.

and i get the following error message if i add the form_submit function

  Notice: Undefined index: value in user_registration_form_submit() (line 37 of /var/www/html/lite/sites/all/modules/user_regestration/user_registration.module).

  PDOException: SQLSTATE[HY000]: General error: 1364 Field 'entity_id'
  doesn't have a default value: INSERT INTO
  {field_revision_field_first_name} (field_first_name_value) VALUES
  (:db_insert_placeholder_0); Array ( [:db_insert_placeholder_0] => ) in
  user_registration_form_submit() (line 38 of
  /var/www/html/lite/sites/all/modules/user_regestration/user_registration.module).

THIS IS LINE 37 AND 38 OF MY CODE

'field_first_name_value' => $form_state['value']['field_first_name'],
))->execute();

I am creating the module on localhost first before i push it to the live website


texts: When should I use hook_field_attach_presave(), and when hook_entity_presave()?

texts:
I was looking for a way to act on entity fields before they are saved, and I have noticed the following about hook_field_attach_presave(), and hook_entity_presave():

They take the same parameters, but in a different order.
They are both called when an entity is saved. For example, taxonomy_term_save() contains the following code.

// Invoke hook_field_attach_presave().
field_attach_presave('taxonomy_term', $term);

module_invoke_all('taxonomy_term_presave', $term);
module_invoke_all('entity_presave', $term, 'taxonomy_term');

Similar code is present in comment_save().

field_attach_presave('comment', $comment);

// Allow modules to alter the comment before saving.
module_invoke_all('comment_presave', $comment);
module_invoke_all('entity_presave', $comment, 'comment');

As they get the same parameters, the code I should write to access the entity's fields is the same for both the hooks. This means that, apparently, there isn't any reason to choose one instead of the other hook.

When should I then implement one hook instead of the other? Are there cases where I would implement hook_field_attach_presave()?


texts: Content type with taxonomy in single exposed filter

texts:
i want to a single exposed filter with content types and taxonomy for a single content type,
like i have 3 content types Parts,Tools,Equipments and have a taxonomy for parts with terms Hardware,Instruments and components, now i want a views exposed filter containing both of the them to filter.
Is there any method to do that ?


texts:
I'm trying to tie EntityQueue permissions into Organic Groups, similar to what was done with Smartqueues for Organic Groups (https://www.drupal.org/project/smartqueue_og ) but EntityQueue's API does not contain things like hook_subqueue_access().

/**
 * Implements hook_subqueue_access().
 */
function smartqueue_og_subqueue_access($subqueue, $account, $queue) {
  if (og_user_access($subqueue->reference, 'administer queues', $account)) {
    return TRUE;
  }
  return FALSE;
}`

Do I need to patch EntityQueue to contain the API functions I need? Or are the API functions available through CTools (or EntityAPI) that EntityQueue was built on? And if so, how do I hook those APIs?


texts: Drupal advanced forum - different styles for different forums

texts: With Advanced Forum on Drupal 7, how can I apply different styles to different forum posts, depending upon which forum they are in? Although I can see how to style different forums, there doesn't seem to be any way of using a different style per post depending upon the forum it is in, as there is no CSS class added denoting the posts forum.


texts: Feeds not expiring records after update to alpha9

texts:
I run 3 Feeds multiple times daily.  Has worked Flawlessly for years.  When I updated using composer I now noticed that when importing, the 'Expiring' process never happens.  of the 469 records all are from before August 2020.  Normally the number of records expired would show up as well.
So maybe should I use composer to go back to Alpha7?

The log shows

The settings are

Drupal 8.9.7 using Feeds 8.x-3.0-alpha9


texts: Permanent status/error/warning message on page

texts:
Background
The Drupal 7 messages system works like this:

drupal_set_message() adds a message (status, warning or error) to a message queue in the user session.
When the page is rendered, theme('status_messages') is called, which calls drupal_get_messages() to read and flush the queue of messages. In this way the message queue is tightly coupled to the theme layer.
Themes that want to override the status messages display also need to interact with the messages queue, the same way that the base implementation does.
Natively, the html for messages is like

...

. The classes cause the background color and icon.

Usually a message is meant to inform about an event that happened. It is not really meant for information about the current page.
Problem
Sometimes we want to show a styled notice/warning/error that describes something wrong on the current page, not some event that happened.
The message system can be used for this. But there is no 100% guarantee that a message shows up on the "correct" page:

A message from a form submit can sometimes be swallowed up in a background request.
If a page element that caused the message is cached, the message will disappear on subsequent page visits.
If a page has a fatal error, the message will show up on the next page instead.

Also, the message will always show up at the top of the page, whereas in some cases it would be desirable to have it show up somewhere in the middle of the page.
Question / Goal
I want to create a page element that is styled like regular status/warning/error messages, but that reliably shows up in a custom position on the page, and is not bound to the mechanics of the messages system.
Constraints
The element will be part of a contrib module, and should therefore work across themes.
This means if a theme overrides theme_status_messages() and replaces the classes and appearance for 'notice', 'warning' and 'error', then the element I am building should also be affected by this change.


texts:
I have a fresh install Drupal 7.34 on WAMP. Token and Pathauto are already installed. The Theme, if it is relevant, is Stanford Open Framework.

I have Wordpress_migrate, migrate, migrate_extras intalled and then included features, media and media_youtube as low level diagnostic.

I follow through the instructions to use wordpress_migrate that seem self-explanatory and get this string of errors

Passing a group object to a migration constructor is now deprecated - pass through the arguments array passed to the leaf class instead.
The DynamicMigration class is no longer necessary and is now deprecated - please derive your migration classes directly from Migration.
The field mapping arguments() method is now deprecated - please use subfield notation instead.
The field mapping arguments() method is now deprecated - please use subfield notation instead.
The field mapping arguments() method is now deprecated - please use subfield notation instead.
No migration found with machine name WordPressAuthor
No migration found with machine name WordPressBlogEntry
No migration found with machine name WordPressPage
No migration found with machine name WordPressAttachment
No migration found with machine name WordPressComment
Passing a group object to a migration constructor is now deprecated - pass through the arguments array passed to the leaf class instead.
The DynamicMigration class is no longer necessary and is now deprecated - please derive your migration classes directly from Migration.
The field mapping arguments() method is now deprecated - please use subfield notation instead.
The field mapping arguments() method is now deprecated - please use subfield notation instead.
The field mapping arguments() method is now deprecated - please use subfield notation instead.

The migration does seem to complete but the list of imports under the blog name is  0  0 0 throughout.

I can see that a partial XML file has been transferred from Wordpress.
I have also tried exporting the Xml file from Wordpress and uploading that. I get the same errors.

The string of red errors suggests the entire module is borked. Is that correct? In which case, what is the best strategy to migrate a Wordpress blog to Drupal.

If the module is not borked then any suggestions what I might have missed or misunderstood?

I clearly do not understand the underlying problem, so please do not bite my head off.  A clear orientation will be received with sincere gratitude though.


texts: Hooking a JS script at node submission to alter data submitted

texts:
I am building a website in which a lot of the text comes from Word docs.
The problem is that when you copy from a Word doc to WYSIWYG editor, the resulting HTML and CSS is horrible.

I want to implement a JS script that will run whenever a node (Drupal's basic page) is created or updated, to clean and optimize the data.

I've seen that I must create a custom module and use a hook.
Looking through the list of Drupal 7's hooks, I've noticed hook_node_submit() which seems perfect but in it's documentation (here) is written:

  This hook is intended for adjusting non-field-related properties.

So:

Do I have any other method simpler than module?
What is the correct hook I should use?


texts: How do I fill form elements via onblur events?

texts: I have a user form in which I have to fill all information related to a user. I have only the email address, and I'd like all other fields to be filled when I enter the email address by using the onblur event. So I have to create a module that is called after I have filled email on the form. Via the module I will fetch all other field data.


texts:
I am trying to get the value of a field that is displayed in a panel page. I might be going about this all wrong, because I'm still getting used to Drupal 8. I want to display book information, including the ISBN value, which I use to make a link to Amazon.

I first tried a node template: node--book_page.html.twig and was able to do it by inserting the value of {{ content.field_isbn10.0 }} into the URL I added to the twig. This worked great, but when I tried doing the same thing to the template that I set up to be used by the panel page, nothing happens.

I know I have the custom layout twig working as it should, but I'm guessing that there is more to requesting the value than {{ content.field_isbn10.0 }} now that it's going through node_view in Panels.

I have tried adding it to the panel page as entity_field:node:field_isbn10 as well as field_block:node:book_page:field_isbn10. I just can't seem to get how to access the ISBN field value like I did in the node template.

Here's what shows using kint:

Here's the top of that knit:


texts: Have to delete cron_last every time for cron.php to work

texts:
I am having trouble running cron.php. For testing, I am just running it from the browser (my_domain/my_site/cron.php.) Basically, if I go into the database and delete cron_last from the variable, it works fine, for one iteration, but the next time I try to run it, it doesn't work (until I delete the cron_last value again)

I put watchdog statement in cron.php. From that I could see that it runs until it hits drupal_cron_run. That statement doesn't execute correctly.

drupal_cron_run in in common.inc, so I put more watchdog statements in there. It fails to run past module_invoke_all('cron').

module_invoke_all is in module.inc, so I looked in there, but now I'm stuck. Any ideas?


texts: Why do my custom elements not get rendered?

texts:
I've tried to create custom Webform elements of type radios and checkboxes. The element is available in the Webform UI for admin, I can add it to my webforms from build section but it is not getting rendered in webform frontend. I have no idea what I'm missing.
(Note: I have created another custom elements of type textfield, selectbox, autocomplete and they all are working fine.)
Below is my custom src/Element code and src/Plugin/WebformElement code: (Do I need to add/modify any other files to get this elements rendered on frontend form?)
--> src/Element/MyCustomRadio.php

<?php

namespace Drupal\my_custom_element\Element;

use Drupal\Core\Render\Element\Radios;
use Drupal\Core\Render\Element\FormElement;
use Drupal\Core\Form\FormStateInterface;

/**
 * @FormElement("my_custom_element")
 *
 */
class MyCustomRadio extends Radios {

  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    $class = get_class($this);
    return [
      '#input' => TRUE,
      '#size' => 60,
      '#process' => [
        [$class, 'processMyCustomRadio'],
        [$class, 'processAjaxForm'],
      ],
      '#element_validate' => [
        [$class, 'validateMyCustomRadio'],
      ],
      '#pre_render' => [
        [$class, 'preRenderMyCustomRadio'],
      ],
      '#theme' => 'input__my_custom_element',
      '#theme_wrappers' => ['form_element'],
    ];
  }

  public static function processMyCustomRadio(&$element, FormStateInterface $form_state, &$complete_form) {
    // Here you can add and manipulate your element's properties and callbacks.
    return $element;
  }

  public static function validateMyCustomRadio(&$element, FormStateInterface $form_state, &$complete_form) {
    // Here you can add custom validation logic.
  }

  /**
   * @param array $element
   * @return array
   */
  public static function preRenderMyCustomRadio(array $element) {
    $element['#attributes']['type'] = 'checkboxes';
    Element::setAttributes($element, ['id', 'name','value']);
    static::setAttributes($element, ['form-text', 'my-custom-element']);
    return $element;
  }

}

================================================================================================
--> src/Plugin/WebformElement/MyCustomRadio.php
<?php

namespace Drupal\my_custom_element\Plugin\WebformElement;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElement\Radios;
use Drupal\webform\Plugin\WebformElementBase;
use Drupal\webform\WebformSubmissionInterface;

/**
 * Provides a 'my_custom_element' element.
 *
 * @WebformElement(
 *   id = "my_custom_radio_element",
 *   label = @Translation("My Custom Radio"),
 *   description = @Translation("Provides a webform radio element."),
 *   category = @Translation("My Custom elements"),
 * )
 */
class MyCustomRadio extends Radios {

  /**
   * {@inheritdoc}
   */
  protected function defineDefaultProperties() {

    return [
      'multiple' => '',
      'size' => '',
      'minlength' => '',
      'maxlength' => '',
      'placeholder' => '',
    ] + parent::defineDefaultProperties();
  }

  /**
   * {@inheritdoc}
   */
  public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
    parent::prepare($element, $webform_submission);

  }

  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);
    return $form;
  }

}

================================================================================================
I have also attached image so that it can help oneself to understand the problem clearly. This module is made in fresh drupal 8 instance. Please let me know if any specific detail is required.
In admin panel: (i have option to add custom radios in my form)

In frontend: (Custom Radios is not rendered, only drupal&contrib radios and checkboxes is rendered)


texts: QR Barcode automatic creation from Nodes new or previously created

texts:
I wish to create automatically created barcodes from newly create Node content and also Node content already created in the Drupal V7.3x system. Further to my previous posting Barcode Creation I can allow a user to create a QR barcode from a text field entered on a Node Form which successfully shows the QR on the Node display page; but this is no longer what I want, I require the QR code to create on the fly to create the QR code which will ultimately be the URL of that Node which is being shown so that the user then can scan it and save for later ie on a mobile device.
I have tried with Rules, but to date cannot get the Rule to write, save or show any QR code.

If it is a PHP script code, then what would it be to create onto the Node page the user would see.

I want to do it via Rules is possible but the barcode field wasn't showing in Rules. Any advice on a correct procedure or a Rules structure is most welcome.

PS:

I have found this type of PHP on https://www.drupal.org/node/1364118, and I wonder if this is the direction I need to go? to solve it:

    <?php
if (!isset($commerce_product->field_barcode['und'][0]['value'])) {
$commerce_product->field_barcode['und'] = array(0 => array ('value' => $commerce_product->sku));
}
else {
if ($commerce_product->field_barcode['und'][0]['value'] == '') {
$commerce_product->field_barcode['und'][0]['value'] = $commerce_product->sku;
}
}
commerce_product_save($commerce_product);
?>


texts: How to set checkout process per item basis

texts:
I am developing a site with Drupal Commerce.

The client needs a multiple recipient feature. He needs per-item per-recipient feature.

Suppose 1 customer buys 3 items, he will have 3 checkout box containing 1 item with all information to fill (like shipping info, gift message etc) in the checkout process and then goes to next line item using the same process, then goes to next.


texts: Flickr-like responsive photo gallery for Drupal 8

texts:
Is there a good Drupal 8 module to display a responsive photo gallery, a la Flickr (example: https://www.flickr.com/photos/tags/red)?

I tried Views Photo Grid but it's not working for me, when I go to create a view type of "Photo grid" per the instructions that option is not listed.

If there's no Drupal 8 module, what'd be the easiest way to go about creating this feature? Creating a photo content type, then a view? Is there a way to pull in the viewport size then dynamically size the thumbnails accordingly?

Thanks.


texts:
Is it possible to retrieve a user's order history programatically?

Ideally, I would be able to user the user's profile ID to then load multiple past orders.


texts:
I have been trying to find a sensible solution to this problem with no success so far.

I have a site running Drupal 7 – and have built a basic content type which allows content admins to upload their own PDF documents using a file field. The content admins now what to be able to rename the PDF title that appears in the download link to whatever they want, but I can’t find a workable solution to achieve this. I have tried File (Field) Paths, but it was a disaster – full of bugs.

Is there a module out there somewhere that can allow what should be simple functionality?


texts:
Looking for a simple solution that will allow you to insert a script such as Google Adsense ad or HTML in the Body field of a content type.

The insert can be after the first five paragraph tags in the Body field. Or maybe in the middle of content.

While on Wordpress there were a lot of plugins to do this, in Drupal I can't find a solution. There are blocks, but you can't inject them in the middle of content.

Any help is greatly appreciated.

Tried this in as a module but can't get it to work.

<?php

function adinject_node_view(array &$build,
\Drupal\Core\Entity\EntityInterface $entity,
\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {

if ($entity->getType() == 'vehicle_repair_guides' && $view_mode == 'full') {
$pieces = explode('
', $build['body'][0]['#text']);
$new_text = '';
foreach ($pieces as $key => $value) {
$new_text .= '
' . $value;
if ($key == 2) {
$new_text .= '
AD GOES HERE!
';
}
}
$build['body'][0]['#text'] = $new_text;
}
}


texts: How to access services_views the correct way?

texts:
I am trying to fetch some views with the services_views module. Sadly enough I keep getting the response: "404: Not found: Display  on view my_view_name could not be found".

I am using Views 3 and I defined for test a view with a 'page' display id. (default display id is not a "default" anymore)

I know that I have to pass the display_id argument but simply can't make it work.

Here is the calls I am trying to use:

http://www.mywebsite.com/rest/views/my_view_name.json?display_id="page"
http://www.mywebsite.com/rest/views/my_view_name.json?display_id=page
http://www.mywebsite.com/rest/views/my_view_name.json?parameters[display_id]="page"
http://www.mywebsite.com/rest/views/my_view_name.json?args[display_id]="page"

In the resource definition for the service it is clear that display_id has to be passed as an argument.

'args' => array(
  'view_name' => array(
    'name' => 'view_name',
    'type' => 'string',
    'description' => 'The name of the view to get.',
    'source' => array('path' => '0'),
    'optional' => FALSE,
  ),
  'display_id' => array(
    'name' => 'display_id',
    'type' => 'string',
    'description' => 'The display ID of the view to get.',
    'source' => 'param',
    'optional' => TRUE,
    'default value' => 'default',
  ),...

Is there anyone who managed to make this work?

Thank you.


texts: How to insert HTML that includes an ampersand>

texts:
I've created a custom block, and I'm trying to get this custom block to output a specific piece of HTML. The HTML needs to be different on every page, because it needs to include the page's URL in it. For instance, if the page is http://www.businesskorea.co.kr/article/7789/content-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor, then the block should output:

This is to be compatible with daum.net's news publishing functionality. The code that I've written up for this custom block looks like this:

<?php

/**
* Implements hook_block_info().
*/

function bkcustom_block_info() {
  $blocks = array();
  $blocks['bkcustom_daum_json_block'] = array(
    'info' => t('BKCustom Daum JSON'),
  );
  return $blocks;
}

/**
* Implements hook_block_view().
*/

function bkcustom_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'bkcustom_daum_json_block':
      $block['subject'] = '';
      $block['content'] = BKCUSTOM_DAUM_JSON_BLOCK_CONTENT();
      break;
  }
  return $block;
}

function BKCUSTOM_DAUM_JSON_BLOCK_CONTENT() {
  $path_alias = drupal_get_path_alias($_GET["q"]);

  $encoded_path_alias = urlencode($path_alias);

  $output = t("");

  return $output;
}

Which outputs almost, but not quite, what I need. The output changes ampersands to &amp;, and somehow deletes the final forward slash (/) at the end of the IMG tag. The output looks like this:

The most frustrating part of this exercise is that if I delete the opening and closing brackets, <>, the code works perfectly and prints out each character exactly as I need it to. That's how I tested to see if it would work. But when I introduce opening and closing brackets, the code changes and the JSON query or whatever the crap this is fails.

How can I preserve the & and / characters?


texts: How to call functions from another module in hook_language_negotiation_info()?

texts:
I am writing a new custom module which is dependent on geoip module. I'm trying to add another language negotiation in the language detection configurations which would trigger a callback function defined in the module. Now How do I call the function defined in geoip.module file? I tried calling the function directly and after a module_load_include and both do not work.

/**
 * Implement hook_language_negotiation_info
 */
function my_module_language_negotiation_info() {
  return array(
      'geoip_language_provider' => array(
          'callbacks' => array(
              'language' => '_my_module_language_callback',
          ),
          'file' => drupal_get_path( 'module', 'my_module' ) . '/my_module.module',
          'weight' => -4,
          'name' => t( 'My Module GeoIP Negotiation Provider' ),
          'description'=> t( 'This redirects the user to correct language based on their IP.' ),
          'cache' => 0,
      ),
  );
}

function _my_module_language_callback() {
  module_load_include( 'module', 'geoip' );

  //Returns array of languages based on country code. Eg. array( 'CN' => 'zh-hans',)
  $languages = _my_module_language_mapping();
  $country_code = geoip_country_code();
  $default_langcode = language_default( 'language' );

  if( !isset( $languages[$country_code] ) ) {
    watchdog( 'geoip_language', 'The country code is not in the language mapping.' );
    return $default_langcode;
  }

  return $languages[$country_code];
}


texts:
I'm trying to write my first module and am using the hook_menu to route the pages. The module consists of a multi-step form and two static content pages.

/**
 * Implements hook_menu().
 */
function order_menu() {
  $items = array();

  $items['order/form'] = array(
    'title' => 'Order Form',
    'description' => 'Order multistep form.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('order_form'),
    'access callback' => TRUE,
    'file' => 'order_form.inc',
    'tpe' => MENU_CALLBACK,
  );

  $items['order/cancel'] = array(
    'title' => 'Order Cancelled',
    'description' => 'Order cancelled.',
    'page callback' => 'order_cancel',
    'access callback' => TRUE,
    'file' => 'order_form.inc',
    'type' => MENU_CALLBACK,
  );

  $items['order/success'] = array(
    'title' => 'Order Success',
    'description' => 'Order Successful.',
    'page callback' => 'order_success',
    'access callback' => TRUE,
    'file' => 'order_form.inc',
    'type' => MENU_CALLBACK,
  );

  return $items;
}

What I want to do is be able to access 'example.com/order/form' from 'example.com/order' but when I change the menu hook from $items['order/form'] to $items['order'] it displays as page not found.

Any suggestions as to how to how to get the module to display the content I want from example.com/order?


texts: Log where permissions are being refused?

texts:
When not logged in as admin my view is returning no results. I believe it to be a permissions issue but everything appears to be configured correctly.

Is there a way to get a log of what permissions are being attempted and then rejected, and by what?


texts:
I can use hierarchical select module but it contains lot of manual work in entering data. I want for all countries their city list. How to do it ?

Is there any module which helps to show city list based on a country selection? Is there a custom way to do it? thanks in advance


texts: Create dynamic external link URL without filtering or stripping protocol

texts:
In my module I'm creating a dynamic external link to launch a local FileMaker database client and run a FileMaker script that finds a record like so:

FMP://192.168.123.123/DatabaseName.fmp12?script=FindRecord&RecordID=12345

The problem is no matter whether I use the Drupal 7 link l() function with attribute array absolute = true or external = true or if I assemble the link markup myself, either the anchor's href attribute gets stripped entirely or the protocol of FMP gets replaced with HTTP.

What do I need to do to let Drupal know this URL is safe to be outputted unmolested in outgoing emails?


texts: How do I move content from one field to another?

texts:
I have created a field called people_field. I used this in another content type as an existing field. The problem is now it's screwing up a view that uses the field in a relationship.

So what I want to do is keep the content but make move all the data from one filed into a new field, if that makes sense?

I can't figure a way to do this without losing all my data.


texts:
The scenario is, I have a form that you order multiple types of stationery. Depending on what items are ordered determines, what email needs to be sent the form results.

The issue I am running into is I need a way to prevent emails from being sent to the other print vendors if their fields are left blank.

Right now they all receive every email it just shows up blank because I have it set to exclude blank fields.

Any guidance would be greatly appreciated!


texts: How to get correct language code during installation?

texts:
I am programmatically creating some content during installation of my profile and I need to set the language for this content, otherwise it will be in English(which my site is not) and there will be issues with visibility of fields.

What is the proper way to get the language code in which the site is being installed? The language manager service is returning English, which is incorrect.


texts: Is it necessary to re-patch an existing patched module when doing a security update for that module?  I am not interested in keeping it patched. Or will this potentially break something?


texts: Helper to get the raw value of a node field?

texts:
I wonder if something "core" already exists that gives me the raw value of a field inside a node. For that matter I wrote this little helper, but it seems too strange not to be able to do it with a core function:

function mymodule_get_node_field($node, $name, $lang = 'und', $key = 'value') {

  if (substr($name, 0, 6) != 'field_') {
    $name = "field_{$name}";
  }

  if (!is_object($node) || !isset($node->{$name}) || !isset($node->{$name}[$lang])) {
    return null;
  }

  return $node->{$name}[$lang][0][$key];
}


texts: Print admin toolbar icon in custom module

texts:
How can I print the admin toolbar icon for my module?

I created a module and it has a menu in the admin toolbar. I want to show an icon (module/costum_module/image/00/icon.svg) in this path for my admin toolbar tab.

I created a CSS style for that, but it doesn't work.

Module path :

/module/my module/css/styles.css   =>

.toolbar-icon-mymodule-list:before {
    background-image: url(../icons/787878/icon.svg);
}
.toolbar-icon-mymodule-list:active:before,
.toolbar-icon-mymodule-list.active:before {
    background-image: url(../icons/000000/icon.svg);
}

/module/my module/mymodule.libraries.yml   =>

mymodule.styles:
  css:
    theme:
      css/styles.css: {}


texts: Views Attachment repeating on each category page

texts:
I know I'm just beginner about Views Attachments - I think I learned how to put a sticky article teaser on Category page Above all others; - but as there are many numbered Category pages i.e. ?page=1 ; page=2 etc. - and so my Attachment appears on every page -

but how to make it only on base URL page and not all?

p.s. my term/ category pages are all Views / Replicas


texts: Choose a facet using the search form and then show filtered results

texts:
The requirement is that the user specifies a facet before they search. Here's what the search form should look like:

Adding the select list to the search form is a straight forward form_alter(). My problem is how do I send the selected audience value from the drupal form to solr?

Once I have the audience value in the solr query object, I think I would apply the facet by using HOOK_apachesolr_query_prepare() (or HOOK_apachesolr_query_alter()).

Thanks!


texts: How to assign a content type to a workflow programmatically?

texts:
is there any way that by code can assign a type of content to a workflow? I have reviewed the workflow module but I have not managed to find a method or a service that allows me to do it.

What I am trying to emulate is the action that makes this modal (programmatically not visually):

The only way I have found is by manipulating the workflows.workflow.myworkflow.yml

Per I'm trying to find a cleaner way.

Does anybody have an idea?


texts:
Either I'm stupid or I can't search. Sorry if this is a duplicate, but I can't find any answer to my problem.
I made a custom block type in admin panel, named it content_under_listing, and then I made two blocks of it - the first has id 1, the second has id 2. Then I made a Plugin / Block with file ContentBlock.php. I render it in my twig.html file with line {{ drupal_block('content_block') }} - and it works, it displays what I have in build() function in my ContentBlock.php file. And now: how the hell can I display in that block every blocks of type content_under_listing, which I created in admin panel?

Here is the code of ContentBlock.php:

1) this way I can display every block, but with it id, and I don't want to write it by hand 1, 3 or 54. I want to display all of blocks of type content_under_listing. Is it possible?

  public function build() {
    $bid = 1;
    $block = \Drupal\block_content\Entity\BlockContent::load($bid);
    $render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);
    return $render;
  }

2) So I tried with sth like work with nodes, but it doesn't work:

public function build() {
    $build = [];

    $storage = $this->entityTypeManager->getStorage('block');
    $query = $storage->getQuery()->condition('type', 'content_under_lisitng');
    $bids = $query->execute();
    $blocks = $storage->load($bids);

    $build['#theme'] = 'content_block';
    return $build;
  }

$blocks is empty.
Please help.

EDIT
Code after edit:

  public function build() {
    $storage = $this->entityTypeManager->getStorage('block_content');
    $query = $storage->getQuery()->condition('type', 'content_under_lisitng');
    $bids = $query->execute();
    $blocks = $storage->loadMultiple($bids);
    $result = $this->entityTypeManager->getViewBuilder('block_content')->viewMultiple($blocks);

    devel_dump($query);
    devel_dump($bids);
    devel_dump($blocks);
    devel_dump($result);

    return $result;
  }

and the result:


texts:
Using the Drupal Solr admin UI I indexed all queued content.
However, even if everything is indexed and searchable, it indicates, as seen below, that only 2% has been indexed!

Indexed         31084 Items (934.03 MB on disk)
Remaining   30597 items (2% has been sent to the server)
Schema          drupal-4.1-solr-3.x

The problem is that when I want to index the remaining, it starts from zero.
Why is that? Is it a bug?


texts:
I have views1 and view2, where in first view linked with view2 so I have given contextual filter in view both for entity reference field of view2.

Now my problem is when I pass nid of view1 at Preview with contextual filters: it not retaining any data the contextual filter is not working.


texts: Why is my twig variable not working inside my block twig?

texts:
I have a field I'm pulling into a block twig template block--block-03.html.twig, and it outputs fine by itself (= {{content.field_content_side}}). But when I put it inside of a conditional it is not working.

Here's my code to illustrate what I mean:

{{ content.field_content_side }}

{% if content.field_content_side == 'left' %}col-sm-push-7{% else %}wtf{% endif %}

The output is here:

Why is it recognizing the twig variable correctly as left (= 1st line of my code), but in the conditional it is saying it's not left (= 2nd line of my code)?


texts: How do I enable the WYSIWYG editor on fields?

texts:
I added couple of Text fields on a content type in Drupal; however, only the in-built "body" fields is WYSIWYG editor enabled. I am using FCKEditor as the WYSIWYG editor (installed under the Wysiwyg module).

How can I get WYSIWYG editor enabled on custom added field?


texts: Problem installing Drush 7 due to missing ext-pcntl PHP extension - any workarounds?

texts: I attempted to install Drush 7 using the "manual install" instructions, and the "composer install" step failed with the error that the ext-pcntl PHP extension was not found.  The hosting company (which I don't have control over choosing) says they are unwilling to install ext-pcntl in a production environment due to security concerns.  Are such security concerns justified?  Is there any workaround for installing Drush 7 without the ext-pcntl dependency?  If not, I might try to install an older Drush version that doesn't have the dependency.


texts:
I'm trying to add some custom actions to my Views Bulk Operations, but for some reason, they don't appear in the list.

This is my code (got it from Drupal.org, so I guess this is a working code...)

function publication_action_info() {
  return array(
    'node_unpublish_action' => array(
      'description' => t('Unpublisedh node--'),
      'type' => 'node',
      'configurable' => FALSE,
      'hooks' => array(
        'node' => array('insert', 'update'),
      ),
    ),
    'node_unpublish_by_keyword_action' => array(
      'description' => t('Unqsdfqsdfpublish node containing keyword(s)--'),
      'type' => 'node',
      'configurable' => TRUE,
      'hooks' => array(
        'node' => array('insert', 'update'),
      ),
    ),
  );
}

So what's wrong with my code or logic to make this thing to work?