texts:
This should be the easiest thing to do, but for some reason I just can't get it done.

I'm trying to get a friendly static error page to replace nasty 500 scenarios. For now I'm just trying to replicate a 500 situation on my local machine (Drupal 7 running on MAMP) by throwing in some crap characters on the top of my template.php in my theme, which does trigger a 500 situation, but for some reason the ErrorDocument directive in my .htaccess or Apache config file has no effect.

What I'm doing is quite simply this:

ErrorDocument 500 /500.html

And I have the simplest ever static html-page in the root of my site with the name of 500.html.

Still, when I intentionally break template.php, I get the dreaded White Screen Of Death instead of my nice friendly error page.

What am I doing wrong here? I've done this a billion times in non-Drupal setups but just can't get my head around this one.


texts: Can I move a webform to another drupal installation?

texts:
I have created a few webforms on our development server and would like to move them over to a production installation. Can I do this with node export?

I'm not concerned with migrate any user responses (as we were only testing).


texts:
I need to access a Node's image field within the page.twig.html template in order to display it in relation to certain page-level elements such as primary/secondary menus and the page title.

In node.html.twig, I'm able to access it like so:

{{ content.field_responsive_hero_image.0 }}

but in page.html.twig if I try

{{ node.field_responsive_hero_image.0 }}

I get the following error:

Exception: Object of type Drupal\image\Plugin\Field\FieldType\ImageItem cannot be printed

I'm familiar with the workaround of loading the image with

<img src="{{file_url(node.field_responsive_hero_image.entity.fileuri)}}" />

However, I then lose the title and alt attributes (bad for 508 compliance) as well as the automatic resizing of the image served based on screen size (bad for SEO rankings).

How do I access the Node's image at a page-level?


texts: I am building a site that requires payment, from paypal for instance, as part of the user registration. What approach should I take?


texts: how to get css "background-color" value from content types

texts:
I have a custom type, and I want to set background-color of it,when end user choose the color in add content page,
        example :  set background-color : black
, I want get this value from database, and set style in my theme.
how to do this?


texts: How to convert hook_xmlsitemap_links to xmlsitemap 6.x-2.x API?

texts:
While writing a test harness for a module I wrote, I discovered my implementation of hook_xmlsitemap_links wasn't actually called anymore.

The module doesn't work with nodes but gets data from sources other than Drupal and themes that. It implemented hook_xmlsitemap_links to add its urls to the sitemap.

Is there some documentation on how to replace a hook implementation with its equivalent(s) in the new 6.x-2.x API, that breaks my search-fu style?

I found it is "kinda hard to explain" and was reading the code like suggested.


texts: Do we need any init steps in this scenario?

texts:
In Order to install Drupal Core using Code deploy, I follow these steps.

Download drupal-7.x.zip
/usr/bin/unzip -o /tmp/drupal.zip
/bin/mv /var/www/drupal-7.x /var/www/drupal
Similar steps to download and unzip the modules / themes etc
Deployment of configuration under sites and restart apache

Do we need any Drush init steps in this scenario? How do we upgrade using Drush commands only?


texts:
I tried using Drupal field collection module. I am getting the following error when I try to save the content using this field collection. I tried searching for anything related but couldn't find any resources

Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1364 Field 'revision_id' doesn't have a default value: INSERT INTO {field_collection_item_revision} (item_id, ds_switch, _deleted, _rev) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 5 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1-ba69446ba6019904db7085d3af46e6f2 ) in Drupal\multiversion\Entity\Storage\Sql\NodeStorage->save() (line 160 of modules\multiversion\src\Entity\Storage\ContentEntityStorageTrait.php).


texts: Why all core services cannot be registered in core.services.yaml?

texts:
DrupalKernel
  Building of Dependency Injection Container and registration of Service Providers Core provides the CoreServiceProvider, which, in addition to registering any core services that cannot be registered in the core.services.yaml file, adds any compiler passes needed by core, e.g. for processing tagged services. Each module can add its own service provider, i.e. a class implementing Drupal\Core\DependencyInjection\ServiceProvider, to register services to the container, or modify existing services.

Why cannot all the core services be registered in core.services.yaml?
 Why do we need a service provider class to register services or modify existing services, when we can register services in module.services.yml?


texts: Drupal 8 blocks content is not being translated

texts:
I've searched high and low but can't seem to find any question that has the same problem. We're experiencing blocks that have content that is not being translated. For example, a custom block that has a simple translatable string and is being translated into a different language, it will simply always show the source language. What's up with that?

$build['test_content']['#markup'] = $this->t('Test NL');

Edit: For the record; we have translated this string into the target language but still doesn't show up on the corresponding language.


texts:
I want to add a class on cck image field output img tag, not on field wrapper div.
How can i do it?


texts: Create a view of all nodes that have the same value for a specified field as the current node

texts:
So I have an event, which has a field called 'field_location'. I want to create a view on the event page where all other events are listed with the same location. In this case location is a node reference to a node (with content type 'location').

How can I dynamically filter all my event nodes on 'location value of the current event'?
I tried this with contextual filters but here it only checks the field you use, in this case 'field_location', with the content id of the url.

I already tried this but without success.

I get zero results.


texts: How do I access the variables posted in a page callback?

texts:
Ok I don't know why I am having such a hard time getting my mind around how to do this. How do you access posted values in your page callback? Something in Drupal seems so hard. All examples just call drupal_get_form() but what do I do if I want to display the form and any results from the submit?

function stock_quotes_menu(){
    $items['stock-quotes'] = array(
     'title' => variable_get('market-summary-title', 'Stock Quotes'),
     'access arguments' => array('access content'),
     'page callback' => 'stock_quotes_page',
    );

    return $items;
}

function stock_quotes_page() {
    $symbols = isset($_REQUEST['symbol']) ? strtoupper($_REQUEST['symbol']) : '';
    $out = "<pre>".print_r($_REQUEST,1);
    if ($symbols != '') {
        $start = NULL;
        $pos = strpos($symbols, ",");
        /*if($pos == false){
            $start = date('Y-m-d');
        }*/
        $quotes = stock_quotes_fetch_yql_quote($symbols, $start);
        $out = print_r($quotes, 1);
    }

    $form = drupal_get_form('stock_quotes_get_form', $symbols);
    $build['snippets'] = array(
      '#type' => 'node',
      '#title' => '',
      '#prefix' => drupal_render($form),
      '#markup' => $out
    );

    return $build;
}

function stock_quotes_get_form() {
    $form['symbol'] = array(
      '#title' => t('Symbol(s)'),
      '#type'  => 'textfield',
      '#required' => TRUE,
      '#description' => t('Enter Symbols or Symbols seperated by , to get quotes'),
      '#default_value' => !empty($form_state['values']['symbol']) ? $form_state['values']['symbol'] : 'Enter A Symbol',
    );

    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => 'Get Quote'
    );

    return $form;
}


texts: I have created 2 content types one is called Album and the other is Image. I gave Image a reference field so it's linking to Album. Now when a user goes to upload a image how can I make it auto reference to the album? cause the user will have no knowledge in using drupal


texts: Rules condition if user has certain roles not working at all?

texts:
I have 2 roles:

Customer
Moderator

I have created a Rule:

Event. On account creation

Condition. If user has role: Moderator (and checked reverse, so when user doesn't have a role Moderator it should return TRUE), also as data selector i chose "account"

Action. Assign role: Customer, selector "account"

However, when i logged in with a user with role Moderator and create a new user with role Moderator it automatically adds the role customer as well. So my condition isn't working?

UPDATE I have tried in conditions: [site:current-user], still it adds the "Customer" role to a newly created account with a role Moderator by Moderator


texts: Drupal 7 CDN Module not altering URLs for themed Pages

texts:
I have themed a page on my Drupal 7 website by mentioning the template file as
page--node--.tpl.php
The CSS and Images which are coming on this page are getting picked from the site itself and not from the static url i have configured in CDN.
Other than this page my website is picking CSS JS & Images from CDN
Any suggestions ?

Basic page--node--123.tpl.php

<?php
global $base_url;
$img_actl_path =  "$base_url/".drupal_get_path('theme','theme-name')."/images/v1/";
?>
<img src="<?php print $img_actl_path;?>image1.jpg" width="380" height="197" />


texts: drupal bootstrap theme working with superfish

texts:
I hope this will not be too confusing, apology if it is

My situation:

I used superfish so that I can have a navigation menu with dropdown submenu when the mouse hovering the nav items.
I used bootstrap theme to make the whole site responsive
I use 'main menu' instead of 'navigation' as my navigation menu bar
I customised the menu style by changing 'default.css' in superfish, bootstrap.css and style.css in bootstrap theme.
I have unchecked main menu in appearance tab under the theme setting so that the main menu will not show up twice while I'm using superfish.
I am using drupal 7, superfish-7.x-1.8 and bootstrap-7.x-2.x-dev

When the screen size is reduced, the menu bar disappears and the small button in the corner will show up. When clicking this button, the main menu items should be shown as a drop down menu. My problem is: because I unchecked the main menu, the main menu items will not show up when clicking this small button. But the superfish menu (which is main menu, but set in superfish menu) will be there without changing style for small screen. How can I make the superfish menu items behave the same way as normal main menu + bootstrap?

I really don't know how to explain this more clearly and I am really frustrated by bootstrap theme now :(

Any help would be very much appreciated!

thx


texts:
We have a custom table that creates a mixed listing of custom entity and core entity which is needed for the project.

Could someone provide a code example for programmatically creating a view in drupal 8 with mixed entities with a custom query?

I have reviewed Drupal 7 examples out there and they don't seem sufficient.

The goal is to use views powerful field formatting and reordering capability, rather than reinventing that wheel for our custom table display.


texts:
I have a site that has several pages that are just views (a blog page, calendar page, and similar).  I want about 50% of my views to collapse the right column.  Do I have to create a template for each individual view?  Is there any way I can give views 1,2 & 3 a 3-column layout and give 4,5 & 6 a 2-column layout?

Idea: is it possible to add my own custom displays for views and theme those?  Right now I have Page, Block, etc - could I have Page2column and Page3column?  Then I could make my changes in views-view--page2column.tpl.php and views-view--page3column.tpl.php, right?


texts:
How can I uninstall the User Badges Module? I always get the same error when I try:

  Recoverable fatal error: Argument 1 passed to file_delete() must be an instance of stdClass, string given, called in...


texts: How do I add a class to a section in omega?

texts:
Here is the original source:

I want to add some class to it:

I've tried a hook_page_alter() but either I haven't been able to zero in on the specific element or I'm attaching the classes incorrectly.


texts: Commerce product fields as optional attributes

texts:
I'm trying to create some kind of product attributes by adding fields in manage fields in Store | Product types. Is there any solution to give product creator ability to select which fields he want to use when adding product. Creating product types containing all possible situations would be strange.
Example:
I create one customizable product, but I want to give it 4 various attributes. For another creating product I could select checkboxes for different attributes.


texts: How to query for entities without a value for a specific field?

texts:
Using EntityFieldQuery it is pretty easy to query for entities with a given value for a specific field. But I fail to find a way to query for entities without a value for a given field. Let's say I have an optional Taxonomy Reference field on all my content type. I can query the nodes associated with a given taxonomy term using:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'file')
  ->fieldCondition('field_tags', 'tid', $tid)
  ->pager($limit);
$results = $query->execute();

But how would I query for all nodes not associated with any terms (ie. which have no value for the field_tags field). I tried setting $tid to NULL and $query->fieldCondition('field_tags', 'tid', $all_tids, 'NOT IN') without success.


texts: Why doesn't breadcrumb work for taxonomy terms?

texts:
I have created url patterns for the taxonomy terms in the "Article category" vacabulary.
I want the breadcrumb trail to look like this:
"Accueil"> "Blog"> "Categorie"
But I did not succeed.
Currently the taxonomy terms page only displays "Accueil" in the breadcrumb trail.
Why does this not work with the terms of taxonomy ?
However, I created a Views page for "Blog" and "Categorie".
Here are the parameters of the URL alias patterns :

Here is the default Views for taxonomy terms in Drupal :

The term page only displays "Accueil" in the breadcrumbs. It should display "Accueil"> "Blog" > "Catégorie" :


texts: How should I set OR operators between filters?

texts:
I'm maintaining a legacy Drupal 6 site that is running Views 2. I'm building a view that displays content of three different types. One (and only one) of these three content types has a checkbox field, and I only want nodes of that content type to be displayed by the view when that checkbox is checked.

However, as the checkbox isn't present on two of my three data types, if I set a filter that says "only show nodes where this checkbox is checked" all content of these types is excluded. How can I set a filter that says "exclude nodes where this checkbox is not checked, but only if the checkbox is present"?


texts: Create role for changing user accounts and not admins

texts:
I am developing a documentation site for a client. The site has the option of Who can register accounts? set to  Visitors, but administrator approval is required.
So, currently only Admin(user1) is doing the user approval procedure.

Our client has a customer services team which handles this account approval procedure currently. So, if I create a new role (say moderator) and give it permission to administer users (blocking/unblocking, changing role of a particular user), then they will also be able to modify admin users' account; and this is not expected.

Is there a way(any module or either) to restrict moderators to administer only few roles and not admins' role? Is there any other way to do this?

I am looking something similar to this sandbox project, but I want different set of permissions.


texts:
I am using Drupal 7 and the Commerce module.

How can I set the alert message after adding a product in Drupal Commerce.


texts: How to manually create links to change focus on horizontal tab items?

texts:
I have a horizontal tab group with a few horizontal tab items.  I want to create a text link that allows users to move through the tabs instead of clicking on the horizontal tabs themselves.

I found this other question:
How can I activate a horizontal tab?

Unfortunately the answers do not work.  I see that my horizontal tab items have a unique ID. For example, id="node_contenttype_form_group_stuff".  Simply creating a link like the below does not work:

CLICK HERE FOR NEXT TAB ITEM

By clicking on that link, it takes you back to the very top of the horizontal tab groups, but it does not put the horizontal tab item specifically into focus.  It just pulls you back to the top of the page where you can see the horizontal tab group.

EDIT: Looking at the source code, it appears that all the tab items are like the below in the HTML source:

      II. Text of horizontal item #2


texts: Message "No pending update" after update.php (update module)

texts:
Today I updated the security update for the "views".

I always follow the steps for updating a module or core:

1) put site in maintenance mode
2) FTP the files
3) go to link site/update.php

But sometimes i get the message "no pending updates"... after step 3...

When I googled this I read something about some updates don't require a update of the Database.

So, ... If I see this message can i leave step 3 when i update my next site?
I think so, but i prefer a conformation of a Drupal expert ;-)

Thanks for reading and all the info you will leave behind here :-)
Kristof


texts: Active menu for a node with two different terms

texts:
I have a node which has two different terms. The problem is when I'm on such a node, the active menu and breadcrumbs point only to one of the terms. How can I find a solution to this problem without duplicate that node for each term. Or if you have an idea how to duplicate that node but they will be edited in one place that's is also a good solution.
Thanks!


texts: How to detect mobile viewport with in twig?

texts: Is there a way to detect screen display with in twig? I have a block and I want to render in a twig template using the twig tweak module, but only in mobile screen. It is surely possible to just hide it in CSS, but can it be done in twig? - https://www.drupal.org/project/twig_tweak


texts:
I have a list of projects in a view with one image for each project, which is displayed with Lightbox.
The client asked me if it is possible to:

Have more than 1 image, but show the first one (done)
Clicking on the image, make the other images visible

How can I achieve this? Is there any method that is not changing the image formatter?


texts: Is there any sensitive data in the Configuration Management Export?

texts:
I noticed in default.settings.php this comment:

  Location of the site configuration files.

  The $config_directories array specifies the location of file system
  directories used for configuration data. On install, "active" and "staging"
  directories are created for configuration. The staging directory is used for
  configuration imports; the active directory is not used by default, since the
  default storage for active configuration is the database rather than the file
  system (this can be changed; see "Active configuration settings" below).

  The default location for the active and staging directories is inside a
  randomly-named directory in the public files path; this setting allows you to
  override these locations. If you use files for the active configuration, you
  can enhance security by putting the active configuration outside your
  document root.

And then the example:

$config_directories = array(
  CONFIG_ACTIVE_DIRECTORY => '/some/directory/outside/webroot',
  CONFIG_STAGING_DIRECTORY => '/another/directory/outside/webroot',
);

I also noticed that when you export to the directory you specify, an .htaccess file is added that denies access to the directory.

I understand that most people will not want their configuration available for anyone to read, but what if your site is in a public repository?

https://github.com/davidbarratt/davidwbarratt/tree/develop/config

Is there anything I should be concerned about? Could this data be used to exploit the site?


texts: Redirect all www addresses to non-www web addresses

texts:
How can I redirect all traffic from www.domain.com/page to domain.com/page?

I need to disallow traffic to web addresses that include the www. The reason is that I have an SSL certificate that only works with non-www web addresses. If users try to access https://www.domain.com, they get a certificate error.


texts:
Is there a way to limit users on my site to buy only 2 items from a list of products?
Am using Drupal 7 with Commerce module and Rules.
I added a new rule to when adding or removing and item from the shopping cart, it would check if the total quantity is bigger than 2, then it would remove the last element like this.

  Event
  Before adding a product to the cart

  After adding a product to the cart

  Conditions

  Total product quantity comparison
  Parameter: Order: [commerce_order], Operator: >, Quantity: 2

  Actions

  Remove an item from a list

  Selected list: commerce-order:commerce-line-items

and the item to remove is

  commerce-order:commerce-line-items:2

Sadly its not working, and I really need your help.
thanks


texts: Images not being uploaded to defined Image Style folder on server

texts:
Drupal 7 site.  For over 5 years we've had no trouble uploading images to view with a blog.  This weekend we had Ningx loaded on our server.  Hosting co. is certain that's not issue. Maybe it isn't. But...

What is happening is when we upload File Type of Image it now puts it in "/files" folder.  Not the subfolder under it: "files/styles/wnhs870x325/public" designated by the Image Style.  If I manually copy the file over to subfolder image displays correctly.

Any ideas why the image is uploading to one location but looking for it in another.

Thanks -Neil


texts:
I would like to be able to use some custom PHP code that generates an SVG image in my .tpl.twig file. Since I can't write PHP in a twig template I figured I should try and make a twig extension (http://symfony.com/doc/current/cookbook/templating/twig_extension.html)

How could this be done in Drupal? Or is there another way?


texts: How to disable cache on view with ID as contextual filter

texts:
I've got a view (block) wich fetches images from all nodes of content type x. I use these in a slider.

When I open node y, I only want to see the image of node y. So I add a contextual filter to filter on this node.

Here's the thing... It doesn't work. It caches the image, and always shows the cashed image. I already set the view caching to 'none' and disabled page caching.

I've got no clue how to disable the caching for this. Is this view caching? Is this block caching? Is this page caching?


texts:
I have normal Drupal8 Content entity, and I'd like to set up some additional arguments for the entity form builder.

Ie I have entity form path like so: /tilaus/uusi/{tilaus_type} and I'd like to add additional parameter, like so: /tilaus/uusi/{tilaus_type}/{some_additional_argument}. Preferably in a way that would have both of those urls working and I could handle the missing argument in buildForm method.

I've been searching for a while now, but can't find anything about adding stuff to entity form paths. Normal forms are fine and I know how to handle those. It seems that I just can't figure out the entity routing.

So: How to add additional arguments to entity form url and builder?

Cheers,

Janne


texts: How do you disable the CSS from a core module in Drupal 8 using libraries-override?

texts:
I'm trying to disable the CSS styles from the layout discovery module in my theme.info.yml file. I've tried several options, but I can't seem to get it to work. This is what I have now.

libraries-override:
  core/layout_discovery:
    css:
      theme:
        core/modules/layout_discovery/layouts/twocol/twocol.css: false

The CSS styles can be removed using stylesheets-remove at the moment, but that property has been deprecated. It does seem work at the moment, though.

I would like to find the proper way to remove the CSS stules using libraries-override, if I can.

stylesheets-remove:
  - core/modules/layout_discovery/layouts/onecol/onecol.css


texts: How can I return a 404 error page in a node view?

texts: How can I return a 404 error page when a non-registered user tries to see a node page of a specific content type? And of course, the registered users can see the node page normally.


texts:
Within our 'Search Form' block I would like to add a link called "Advanced Search" below the existing Search box.  One possible way of implementing this would be to utilize hook_block_view_alter or hook_block_view_MODULE_DELTA_alter within a custom module and then add this new link to the bottom of this block.
Is this the best way to add this link to the 'Search Form' block?


texts: how to show breadcrumbs only on subpage?

texts:
How can I show breadcrumbs only when the depth level is more than 2.

i.e.:

home > page > subpage => show breadcrumb
home > page => hide breadcrumb

Additionally I would like to hide 'home' also (and always), but this has less priority in my question.

Thanks for your explanation!

Regards,
Hans


texts: Using print render($content['taxonomy']); in node.tpl.php

texts:
I am having trouble getting my taxonomy terms printed into the containing  of my node.tpl.php file. I have named my taxonomy terms for a custom block (books) as     field_tags and I want them to get printed after the $classes array as plain text CSS classes.

Here is the offending line:

<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?><?php print $content['field_tags']; ?> clearfix"<?php print $attributes; ?>>

The goal here is to have a menu on top of this view of books that can select individual titles based on their individual taxonomy terms. Open to suggestions about that as well if you think this plan is stupid.


texts: How to adjust the length of [node:summary] for metatags?

texts:
How can I tweak the amount of characters for [node:summary], so that the description metatag never shows more than 150 characters?

On admin/config/search/metatags/config/node I can only see for description token [node:summary], which does not allow me to control the amount of characters that get displayed on the source code. I would need to trim it to max 150 characters, but I have no idea how/where this can be done.


texts: How to find all views and panels that use a certain field

texts: I want to delete a field but I am not sure if there is still a view or a panel somewhere on the site that is still using it. So I want to know if there is any possibility to find all views and panels that use a certain field?


texts: Link field to node content only with Colorbox

texts:
I would like to show all "content type A" pop up in Colorbox, with "main content" only. Meaning no header, sidebar or footer.

So In my Drupal 7, I installed Colorbox and Colorbox node modules. And created a Views that list all of the "content type A". Then I added a "Content: Title" field with "link this field to the original piece of content" and "display the content inside of a colorbox" are checked. However, the link did pop up with colorbox but it come with full page, which is including the header, menus, footer and everything else. How can I just show the main content?


texts: How to add new content using a content type added after taxonomy access control was installed?

texts:
I have added some content types to Drupal to store some custom content.
Then I installed the Taxonomy Access Control module to manage the access rights. At this point everything was working perfectly and easily.

Then I added a new content type but when I try to "add a new content", this content type doesn't appear in the list of content types.

Is this because of the Taxonomy Access Control module? Do I have to re install it?

Note: I also flushed the cache and performed "rebuild permissions". It appears in the admin/content type filter. but if i add content, no trace of it.


texts: How to return translatable text in render array?

texts:
I'm having a hard time returning translated text as a render array. I have a custom block plugin that will return a message if there's a specific kind of error:

  return [
    'message' => [
      'message' => $this->t('Courses for selected term have not been imported.'),
      '#prefix' => '<p>',
      '#suffix' => '</p>',
    ],
  ];

This doesn't work, it produces an error that 'message' is not a valid render array key.

What am I doing wrong here? $this->t() returns an instance of \Drupal\Core\StringTranslation\TranslatableMarkup which I thought would be appropriate to return, but I think I'm not creating the render array properly.


texts: How do I create one common vocabulary for all Organic Groups but only allow group managers to select from and add their own terms?

texts: Here is the scenario. I have Organic Groups. There is only one content type that they are allowed to post in a group. This content type has a tagging widget that only allows for one tag. I need the Managers of each group to be able to only see or add tags they have created to be attached to the group post. Any suggestions on how to accomplish this?


texts: Single Sign On Integration with NetCommunity

texts:
I want to integrate Drupal with Net Community Black Baud single sign on.

The approach/process flow is same like FaceBook Connect or LinkedIn integration for single sign on.

NetCommunity is just another sign-on site and behaves just like LinkedIn users.

But I am stuck with from where to start the implementation of this.
I have seen LinkedIn module to login with LinkedIn. But I want to know whether it can be done using oAuth library or not.


texts: How to make a Views Filter criteria based on another language version existing?

texts:
How to make a view that lists otherwise Finnish nodes but if there exists an English translation for the node, list that instead?

Filter criteria would be logically "Language: if there is an English translation, then that, else Finnish".

So when all nodes are Finnish, the list of the node titles would be (these are ordinals in Finnish, just for the example):

Ensimmäinen
Toinen
Kolmas
Neljäs
Viides

And then someone adds a translation to the second and third one, the list would become:

Ensimmäinen
Second <--- now links to the English translation of the node
Third <--- now links to the English translation of the node
Neljäs
Viides


texts: How to get a dropdown list with content of other content type

texts:
I have a content type trainer where i have the fields trainer_name, trainer_tel and trainer_email.

I have a second content type club where i want a field that is a dropdownlist with all the trainer names of content type trainer.

How can i do this?


texts:
In Drupal 8 within a custom block how do you display a render array?

I can easily display HTML markup with #markup, but I am not sure how to instead display a render array.

namespace Drupal\hello_world\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Provides a 'Hello' Block.
 *
 * @Block(
 *   id = "hello_block",
 *   admin_label = @Translation("Hello block"),
 * )
 */
    class HelloBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
   public function build() {
return array(
  '#markup' => $this->t('Hello, World!'),
);
   }

 }

I'm trying to instead display a table render element such as the following, but can't seem to figure out how to add it to the block.

I've tried hook_block_view_alter(), like I would with $form['build'], with no success.

I've tried including it in the blocks build function (where #markup is in the sample code above).

I feel like I'm missing something super easy.

I'm trying to basically render something like this to no avail.

$build['table'] = [
  '#type' => 'table',
  '#caption' => $this->t('Our favorite colors.'),
  '#header' => [$this->t('Name'), $this->t('Favorite color')],
  '#rows' => [
    [$this->t('Amber'), $this->t('teal')],
    [$this->t('Addi'), $this->t('green')],
    [$this->t('Blake'), $this->t('#063')],
    [$this->t('Enid'), $this->t('indigo')],
    [$this->t('Joe'), $this->t('green')],
  ],
];

If you need any additional information please let me know.


texts: How to set the value of a Fixed amount Commerce Coupon using Rules?

texts:
It is practically impossible for me to set the fixed amount of a coupon created with rules. The coupon is generated allright with a coupon code but the fixed amount value is always empty, I can only edit the generated coupon and set the fixed amount manually. I am referring to these issues which seemed to have never been resolved:

https://www.drupal.org/node/1785372
create a fixed amount coupon using rules in drupal commerce
http://www.drupalcommerce.org/comment/4433#comment-4433
http://www.drupalcommerce.org/discussions/8436/generate-coupon-using-rules

Edit: I know that Commerce GC exists but it is buggy and not production ready (breaks my site during checkout) and the bug issues havent been resolved.

Here is my exported rule:

{ "rules_send_a_gift_certificate" : {
"LABEL" : "Send A Gift Certificate",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_order", "rules", "commerce_coupon", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
  { "commerce_order_contains_product" : {
      "commerce_order" : [ "commerce_order" ],
      "product_id" : "BGC-1-8",
      "operator" : "\u003E=",
      "value" : "1"
    }
  }
],
"DO" : [
  { "entity_create" : {
      "USING" : { "type" : "commerce_coupon" },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:commerce-coupon-code" ],
      "value" : "ord[commerce-order:order-id]ers"
    }
  },
  { "data_set" : { "data" : [ "entity-created:type" ], "value" : "commerce_coupon_fixed" } },
  { "data_set" : { "data" : [ "entity-created:is-active" ], "value" : 1 } },
  { "data_set" : {
      "data" : [ "entity-created:commerce-coupon-number-of-uses" ],
      "value" : "1"
    }
  },
  { "entity_save" : { "data" : [ "entity-created" ] } },
  { "commerce_coupon_action_create_coupon_line_item" : {
      "USING" : {
        "commerce_coupon" : [ "entity-created" ],
        "commerce_order" : [ "commerce_order" ],
        "amount" : "100.00",
        "component_name" : "commerce_coupon_fixed_ord1ers",
        "currency_code" : "NGN"
      },
      "PROVIDE" : { "commerce_coupon_line_item" : { "commerce_coupon_line_item" : "commerce coupon line item" } }
    }
  },
  { "data_set" : {
      "data" : [ "commerce-coupon-line-item:commerce-total:amount" ],
      "value" : "100"
    }
  },
  { "entity_save" : { "data" : [ "commerce-coupon-line-item" ] } },
  { "LOOP" : {
      "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "mail" : {
            "to" : "[list-item:field-gift-recipient-email]",
            "subject" : "[list-item:field-gift-sender-name] has sent you a Gift Certificate",
            "message" : "Hello [list-item:field-gift-recipient-name], [list-item:field-gift-sender-name] has sent you a \u20a6 [entity-created:commerce-coupon-fixed-amount] Gift Certificate to celebrate your birthday. Your Gift certificate code is: [entity-created:commerce-coupon-code]. Please note that your Gift certificate may only be used once, please spend the full amount in one purchase, any balance remaining is non-refundable. Happy birthday celebration!",
            "language" : [ "" ]
          }
        }
      ]
    }
  }
]
}
}


texts: Role that can set roles but not change its own

texts: In our sites, I have an Admin role (me) and Staff roles.  The Staff role needs to be able to create client user accounts and assign client specific roles to those accounts.  How can I give my staff the permission to set other's roles but not their own?  I don't want them changing themselves to an admin when they want to (and they have).


texts: How to get the name of the current page view

texts:
I'm trying to find a way to check the view name of the current page.

$views_page = views_get_page_view();
if (is_object($views_page)) {
    //get the view name
}

I haven't found any function that gives that information. Any suggestions?


texts: How to add an SQL expression to the entity query? (D8)

texts:
Assume we have an entity query like the following:

$query = \Drupal::service('entity_type.manager')->getStorage('taxonomy_term')->getQuery();
$tids = $query->condition('vid', 'tags')->execute();

and we need to add some SQL expression and condition based on it, like the following:

Replace(name, ' ', '-') = 'some-tag'

How to do that?

The Drupal\Core\Entity\Query\Sql\Query class does not have methods for doing so (unlike Drupal\Core\Database\Query\Select).


texts: Node authors notified by email when a comment is added using trigger module - node token not getting

texts:
My goal is to send a notification email to the node author when a new comment is added. For this i am using trigger module. But didn't get the node author mail id.

Any one experienced in it?


texts:
I have a dropping menu links for the user menu:

My account

Profile edit
My posts (track)
Exit

Here's an example of my code:

<?php echo l(t("Profile edit"), "user/%/edit"); ?>

<?php echo l(t("My posts"), "user/%/track"); ?>

<?php echo l(t("Exit"), "user/logout"); ?>

I've tried with wildcard %. With a Views module was very easy, but in this case (without views) it's not working.
Is any other way so when user clicks on "My posts" will link to user/user_id/track or profile edit that will lead to user/user_id/edit?


texts: Custom ckeditor library plugins not showing

texts:
I created a custom ckeditor library from Ckeditor Builder. I am using the latest version. I tried this library with both ckeditor and wysiwyg module.

When I go to ckeditor settings in admin, I only see basic options and do not see the plugins I added to my custom ckeditor on the ckeditor website.


texts: My company site has moved from D7 to D8 this morning. It all looks great (and so much easier to use!), but I can't see how to amend a footer? One of our office buildings changed its name during the migration earlier this week, so I just need to change one word. In the D7 site, I used to be able to hover over the field and click on the cog icon to amend the copy in the footer, but I can't find how to do this anywhere on Drupal 8. Any ideas?


texts: How can I get the cid of the latest comment I saved using comment_save?

texts:
This is my code to programmatically save comment:

  $comment = (object) array(
    'nid' => $loaded_node->nid,
    'cid' => 0,
    'pid' => 0,
    'uid' => $loaded_node->uid,
    'mail' => $account->mail,
    'thread' => '00/',
    'created' => $loaded_node->created,
    'changed' => $loaded_node->created,
    'is_anonymous' => 0,
    'homepage' => '',
    'status' => COMMENT_PUBLISHED,
    'subject' => $comment_body_subject,
    'language' => $node_language,
    'comment_body' => array(
      $node_language => array(
        0 => array (
          'value' => $comment_body_value,
          'format' => 'msg_filtered_html',
        )
      )
    ),
  );

  comment_submit($comment);
  comment_save($comment);

I want to get the cid of comment just saved. How can I get that?


texts: I created a webform in Drupal 8. While submitting the form, it reloads the whole page, even I had selected inline submission in confirmation message.


texts:
I am trying to show a calendar page with records stored in a custom table, using the Calendar module.

The table has been integrated with Views using hook_views_data. I also implemented hook_date_views_extra_tables and hook_date_views_fields to identity the relevant date fields to the Date module.

So far, I can create a new View with Calendar format (style plugin). When I add the Date: Date contextual filter (argument), I am able to see the field I specified in the hook_date_views_fields. So far so good.

Now when I save the view and show it, no calendar shows. When I get back to edit the view, the Date argument has been replaced with a "Broken/missing handler" notice.

Has anyone succeeded to show a calendar from a custom table?

N.B. This issue was created for the same purpose but it looks like the OP did not pursue it (or at least did not update it).


texts: How to delete old obsolete terms after node's term field has been updated?

texts:
Because the old version of the term is left in the vocabulary and not deleted or updated with the new term.

So what I mean is that vocabulary should contain only terms that exist on at least one node.

I need this because I'm using certain vocabulary on Views as exposed filter and old terms leftovers messes it up.


texts: Custom Views filter for multi-level taxonomy

texts:
I'm struggling to set up two kinds of views for displaying multi-level taxonomy. One would list terms that are final nodes, and the other would list nodes that have children. Somehow, I can't.

I stated that what I really need is a filter criterion "Content: Has taxonomy terms (with depth=1) which have children". Does anyone know of a module/add-in that would add such a filter criterion, or perhaps knows how to define a native Views equiv (I'm still too fresh to say if that is possible).

Thanks
Artur


texts:
I want to try to work with PHPStorm Debug.

I already installed debug on my Mac and changed the php.ini File. Furthermore, I installed the Debug Helper for Chrome and created a Projekt on PHPStorm.

If I start Debug, my PHPStorm will find a connection, but I had the Problem that PHPStorm always jumps into my "index.php" file no matter where I set my breakpoint.

I always have to push the "play" button, but again, it runs always through the "index.php" file and my site (I work with VM) will not load before I push "play".

What do I have to do so PHPStorm only jumps to my breakpoint?

Updated

Attached my PHPStorm Settings:


texts:
In my theme I'd like to have complete control over my menus. I'd like to apply specific classes and wrap the menu however I like. I was thinking I could do this within a template. I see that you can print the menu with this:

<?php
$menu = menu_navigation_links('menu-your-custom-menu-name');
print theme('links__menu_your_custom_menu_name', array('links' => $menu));
?>

But I'm not sure how to edit the individual items within the menu.


texts: What's the proper use of EntityFieldQuery?

texts: In Drupal 7, the API documentation for node_load_multiple() specifies using the $conditions parameter has been deprecated in favor of using EntityFieldQuery. How does one use the class to generate a list of node IDs for use with node_load_multiple()? Are there any other use cases for it?


texts: On a multilingual website using i18n, should I set the built-in Drupal English or my custom English as the default source language for strings?

texts:
I have a multilingual website with five languages.  Because I wanted to extensively customize Drupal's built-in English, I also created a custom language, "U.S. English."  I then disabled the built-in Drupal English; the site now uses my custom U.S. English as the default language.

However, I'm confused about which language I should select to be the "Source language" for string translations on the i18n module's admin/config/regional/i18n/strings page.  Should I select my custom "U.S. English" or the built-in Drupal English?  How does the default language affect string translations?

EDIT: Please note that I am asking about the i18n module's "Source language" for string translations, not the site's default language.  Clearly, I need to set the default language of the site on admin/config/regional/language to my custom U.S. English; if I do not, users of the site will not see it.  The "Source language" for string translations (at admin/config/regional/i18n/strings) is separate from the default language, and I don't understand whether I should set it to my custom language or the Drupal default.


texts: How to create custom forms to filter views results in Drupalgap

texts:
I want to build a views page where user searches for a text (without auto-complete) by entering query in a text box and clicking a button on drupalgap, and I want to have flag links on the results
On the documentation page of drupalgap views exposed filters, http://docs.drupalgap.org/7/Views/Views_Exposed_Filters "building your own forms and constructing own URL parameters" is mentioned but there is no example of that. Is there any example/tutorial of usage like that?
Thanks in advance,

Update:
This is the function that I define my form:

function form_custom_form(form, form_state) {
      try {
        form.elements['name'] = {
          type: 'textfield',
          title: 'Kart No',
          required: true
        };
        form.elements['submit'] = {
          type: 'submit',
          value: 'Ara'
        };
        form.elements['my_markup'] = {
          markup: '

'
        };
        return form;
      }
      catch (error) { console.log('my_module_custom_form - ' + error); }
    }

This is the code which works:

function form_custom_form_submit(form, form_state) {
  form_value = form_state.values['name'];
  form.elements['my_markup'] = {
    markup: '

'
  };
  arac_getir2_pageshow();
}
/*catch (error) { console.log('form_custom_form_submit - ' + error); }*/

function arac_getir2_pageshow() {
  var path_to_view = 'arac_getir';
  views_datasource_get_view_result(path_to_view, {
    success: function (data) {
      if (data.nodes.length > 0) {
        var items = [];

        $.each(data.nodes, function(index, object){
          var node = object.node;
          items.push(
            l(node.title, '#') +
            flag_quick_link(
                    'ara_getir', // The flag's machine name.
                    'node', // The entity type.
                    node.nid, // The entity id.
                    parseInt(node.flagged) ? true : false // The current flag status.
                    )
            );
        });
        console.log(items);
        drupalgap_item_list_populate('#arac_getir2_view', items);

      }
    }
  });
}

This is the one which does not:

  function form_custom_form_submit(form, form_state) {
    form_value = form_state.values['name'];
    arac_getir_page();
  }

  function arac_getir_page() {
    try {
      var content = {};
      content['arac_list'] = {
        theme: 'view',
        format: 'ul',
        format_attributes: {
          /*'data-inset': 'true',*/
          'data-split-icon': 'star' /*the icon to use for the flag button */
        },
        path: 'arac_getir', /* the path to the view in Drupal */
        row_callback: 'arac_getir_list_row',
        empty_callback: 'arac_getir_list_empty',
        attributes: {
          id: 'arac_getir_view',
          'data-filter': 'true',
        }
      };
      return content;
    }
    catch (error) { console.log('arac_getir_page - ' + error); }
  }

  /**
   * The row callback to render a single row.
   */
   function arac_getir_list_row(view, row) {
    try {
      return l(row.title, 'node/' + row.nid) + row.field_kart_no +
      flag_quick_link(
        'ara_getir',
        'node',
        row.nid,
        parseInt(row.flagged) ? true : false
        );
    }
    catch (error) { console.log('arac_getir_list_row - ' + error); }
  }

  /**
   *
   */
   function arac_getir_list_empty(view) {
    try {
      return t('Kart bulunamadı');
    }
    catch (error) { console.log('arac_getir_list_empty - ' + error); }
  }


texts: Importing Drupal Commerce Orders, Customers, Ship to and Bill to addresses

texts: Has anyone successfully imported customers, orders, ship to, and bill to addresses using anything other than a custom module?  If there a recipe for the process?


texts:
We're migrating some code to D8 and in some of our nodes' body field we used to call PHP code directly with the now defunct module_invoke to render a block in the node before the content.

All the examples I can find explain how to do that in D8 with themes or templates, but I need to render the block inside the node body using PHP code, is there a way to do that?

We already tried:

\Drupal::moduleHandler()->invoke($module, $hook, $args = array())

but it doesn't show the block, presumably because it only takes modules?

From this answer we also tried:

$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Trying to print or render $render either doesn't show anything or literally prints out an array.


texts: Allow Custom Form Field '#default_value' to be 0 in Elvis Operator

texts:
Dupal 8.x

I have a custom form field where the value could be zero for radio elements:

$yes_no_options = [
  '1' => t('Yes'),
  '0' => t('No'),
];

$form['config_name'] = [
  '#options' => $yes_no_options,
  '#default_value' => $config->get('config_name') ?: 1,
];

$config->get('config_name') is either equal to 0, or 1. This value gets passed to my .module file to be used in hook_node_access_records(), so 0 and 1 would be preferred.

I could do some converting in the .module file but I am curious if there is a worth while way to allow the 0 value when comparing?

Also wondering the pertinence of worrying about a default value comparison in the form field? If the default value can be set in the hook() maybe this isn't necessary and should just write '#default_value' => $config->get('config_name'),?


texts: How to add autocomplete filter for multi value entity(USER) reference field?

texts:
I have enabled VIEWS AUTOCOMPLETE FILTER module.
I have a field : field_assigned_user which is user reference field and field settings is set to unlimited values.
I have created a relationship entity reference : referenced entity field_assigned_to_user.
I have added a field field_assigned_user which has no relationship and another field: user name having relationship as entity reference : referenced entity field_assigned_to_user.
What should I add in the filter criteria to get autocomplete field for field_assigned_user ?
For entity reference field which is not multi-valued and not an user reference field , the autocomplete field works?
I have referred the video link in the module Drupal 7 Views Autocomplete Filter Tutorial and worked step by step. But for the user reference field no support or help is provided


texts: How can I filter a view to show recent items but only one item per user?

texts:
I am using the Message module to produce a user activity feed for my site.

I want to make a view for the front page that shows the latest user activity (the 10 most recent actions for which I have messages configured) like this:

Bill updated his profile.
Ted updated his profile.
Wayne added a picture.
Garth sent a message.

Making a view that shows this activity was fairly simple.  However, if one user is very active, the results will look like this:

Wayne updated his profile.
Wayne added a picture.
Wayne sent a message.

This doesn't look very good on the front page, and I have many hyperactive users, so what I would like to do is "show the 10 most recent activity messages for 10 unique users."  I experimented with the grouping feature of views, but I haven't figured out how to create a combination that allows me to achieve this.


texts:
On the status report page of a drupal site we run with 7.78, the PHP version number gets reported twice.
We have only setup 1 PHP instance in IIS with version 7.3.24.
How do I correct this to pull from the right PHP instance.


texts: How to expose individual form elements from user-register-form

texts:
So I have a work flow/use case as such:

an administrator user creates a user account, associating it to the "guest" role
the guest users receive a login link
once they log in, I want them to provide some information (in this case, rsvp status, a custom field I've added to the user profile)

Is it possible to display just the rsvp form field of the registration form, so they can update it when they log in (e.g., they submit one field only and the profile is updated)?

Is there another way to do this? I'd rather do this in code since it's part of a custom module that is nearly completed.


texts:
Is it possible to to check is_flagged in views ?

If I send POST request to this URL it works fine http://website/rest/flag/is_flagged but I want do it in Views ?

I am creating REST API using Services Module and what I am trying to check is that whether a Node is flagged by current user or not. /rest/flag/is_flagged this URL works fine but I want to do it in Views.

If its possible please tell me how I can do it ?


texts: How can I add a captcha to this HTML form

texts:
I wanted to add a captcha box to this form. The past developer added this form as html within the content editor.. how can i integrate the captcha to this form? I'm relatively new to drupal and work in wordpress but i am not sure how i can integrate the drupal captcha feature to this form.

    <form action="#" method="post">

Name:
            <input id="Name" type="text" name="Name" />

Email:
            <input id="Email" type="text" name="Email" />

Phone:
            <input id="Phone" type="text" name="Phone" />

Leave this empty:
            <input type="text" name="url" />

How Can We Help?

            <textarea id="Message" name="Message" rows="4" cols="30"></textarea>

            <input id="submit" type="submit" name="submit" value="Submit" />

    </form>


texts: Favicon settings missing on subtheme config

texts:
Using Drupal 8 W3CSS Theme 8.x-1.17, I created a subtheme. The subtheme works fine, but on the settings page, the entire #edit-favicon div is hidden; style="display: none" has been added. I can't figure out why this is happening. However, on the parent theme, the favicon is being displayed. In subtheme.info.yml, features and favicon are set to true.
settings:
  features:
    favicon: true


texts: How do I troubleshoot unit tests using xdebug?

texts: I have xdebug in a Vagrant box, based on VDD, set up and working correctly. Breakpoints trigger phpstorm and mostly works just fine. But when I enable the testing module and try to run a single test on admin/config/development/testing  where a breakpoint in the test source code has been setup, nothing gets triggered. I am assuming that's because PHPUnit is using a separate process. I went though this but it's not helping much.


texts: How can I debug why user_save() is being called twice?

texts:
I have a site with a large number of modules (100+) installed and I have an issue with my rules firing twice, which appears to be caused by user_save() being called twice.  (I was able to confirm this by adding a dpm($account) in user_save(), which is printed to the screen twice on my dev site when I log in as an authenticated user and update that user's profile.

Now I'd like to find which contrib module is caused user_save() to be called twice (of course this assumes it is a contrib module). I'm not a developer so I'm getting stuck.  I have Netbeans set up with Xdebug and I set a breakpoint on user_save().  Then I started the debugger and logged in and updated a user account, but when I look at the call stack I see the following:

  /mysite/modules/user/user.module.include_once:424
  /mysite/includes/bootstrap.inc.drupal_load:1126
  /mysite/sites/all/modules/contrib/devel/devel.module.devel_boot:616
  /mysite/includes/module.inc.call_user_func_array:833
  /mysite/includes/module.inc.module_invoke:833
  /mysite/includes/bootstrap.inc.bootstrap_invoke_all:1097
  /mysite/includes/bootstrap.inc._drupal_bootstrap_page_header:2454
  /mysite/includes/bootstrap.inc.drupal_bootstrap:2214
  /mysite/index.php.{main}:20

And then when user_save() is called again (in the same page load) I see exactly the same output.  If it is a contrib module that is causing user_save() to be called twice, how can I find out which one it is?


texts: Block Node Access After A Certain Amount of Views

texts:
I've come across a client requirement in Drupal that is very new to me.

The website is subscriber based, so users pay to subscribe at which point they are granted a subscriber role. They then have access to particular content types that they did not previously have access to. This is all easy enough.

The challenge though is that they require each node to only be accessible 5 times by each user.

The website is running Drupal 7 and presently has both Content Access and NodeAccess modules installed along with Rules and Flag.

So far I've worked out how to block access to an entire content type using Rules and roles. I've also been experimenting with Rules and Flags to block a node. For example:

If a node is flagged 5 times by the same user, it should be blocked.

But it still seems to come back to requiring a role that is not able to access it. It's impractical to have a role for every piece of content that cannot be accessed though. Content Access and NodeAccess also revolve around roles.

It seems like every possibility I come across requires a role in order to prevent access, which just doesn't work for this situation as every user is going to potentially have a number of different nodes they cannot access and they are all going to be different. This severely limits the ability of roles to work as far as I can see.

Does anyone have any ideas that might be able to point me in the right direction to achieve this?

Thanks in advance for your help!


texts: Is it possible to add form elements to the existing fields with Field API?

texts:
Is it possible solved with field api this task?
I need to add new elements to an existing field.
For example there is a field image. I create a widget and add a checkbox

/**
 * Implements hook_field_widget_form().
 */
function mymodule_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $elements = image_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
  foreach (element_children($elements) as $delta) {

    $elements[$delta]['#process'][] = 'custom_widget_process';

  }
  return $elements;

function custom_widget_process($element, &$form_state, $form) {
  $element['myelement'] = array(
    '#type' => 'checkbox',
    '#title' => t('My checkbox.'),
  );
  return $element;
}

How do I save the value of the checkbox? (If I have a table for it)

Can I add additional column into an existing image field scheme?
(hook_field_schema_alter - not exist)


texts:
I'm newbie and I don't know how Drupal 7 work!
I want to remove with and height from below code:

<img typeof="foaf:Image" src="http://ashkanplastic.loc/sites/default/files/styles/large/public/slider-1a_0.jpg?itok=k4X3QU5U" width="480" height="236" alt="">

Could you please introduce to me why I can not find 480 with $ grep -H -R 492?
And please help to remove width and height.


texts: Organic Groups D7 : How to get custom group list of login user?

texts:
How to get logged in user group list in select box.

Need to help Please suggest me any one ?


texts: I want to have a .pdf application form attached by default as a cck field on a custom content type called vacancies, so that every new vacancy created has the pdf file attached without the user having to upload it manually. Is there any way to do this? Thanks in advance!


texts: Is there a way to add variants to a mini panel?

texts: I am trying to organize my content as follows, but I am not certain if it is proper to use variants (if there are variants for mini panels) this way.  Suppose I have a page A.  I would like to easily re-use A as a block in other pages, say as a block with a portion of the content of A and a read more link and placed in a sidebar of the front page.  Note that I want to do this for a few hand-selected pages, and I hope these blocks can be moved around easily like panes.  So I was thinking if I can do the content of A in a mini-panel A', and use A' in both A and the front page.  But that way I must have two ways to render the mini-panel A'.  So how do I add variants to A'?


texts: Remove duplicate data in revision tables in database

texts:
Possible Duplicate:
  How to disable the revision feature completely?

How can I disable duplicate data in database. one example is this image:


texts: hello_world_page_attachments is not called

texts:
I was following the documentation about creating a custom hello world module.
I got to the point where you are told how to attach custom JavaScript and CSS files using hooks. I want to get a JavaScript file attached on every page. Unfortunately, I can't manage it to work. Everything was working, so far.

This is the code I am using.

hello_world.libraries.yml

hello_world:
  version: 1.x
  css:
    theme:
      css/style.css: {}
  js:
    js/hello_world.js: {}
  dependencies:
    - core/jquery

hello_world.module

function hello_world_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'hello_world_for_drupal_8/hello_world';
}

hello_world.js

alert("outside script");
console.log("outside script");


texts: How can I combine a confirmation mail, especially text for [simplenews-subscriber:combined-url] in simplenews?

texts:
I would like to custom link for the [simplenews-subscriber:combined-url] which appears as http://example.org/newsletter/combined/123/123456789.....
It would be better if the link appears as Subscribe in the email, but I don't know how.
Preprocess function seems to be OK in the simplenews.module file.
$variables['subscribe_text'] = t('Subscribe from this newsletter', [], ['langcode' => $variables['language']]);

I don't know where I can edit (and I'm not sure it is the right solution).
{{ subscribe_text }} : [simplenews-subscriber:combined-url]

In MailBuilder.ph file, buildCombinedMail(array &$message, array $params) could help me, but I'm not sure it is the best way.
$body_key = $actual_changes ? 'combined_body' : 'combined_body_unchanged';
$body = $this->config->get('subscription.confirm_' . $body_key);
// The changes list is not an actual token.
$body = str_replace('[changes-list]', $changes_list, $body);
$message['body'][] = simplenews_token_replace_body($body, $context);
$message['body'][] = 'my custom message here';

Maybe, the best way would be with a template, but I don't see one for combined confirmation emails, and I don't know how to add a custom template to Simplenews module. (There is only one template for newsletter, simplenews-newsletter-body.html.twig.)
Do you have any idea?


texts: How to convert year to date with Migrate

texts:
I try to import a CSV file with Drupal 8 Migrate. One column contains a year value which I want to convert to a Drupal date field.

I try to do that with the following process statement using format_date plugin from Migrate Plus but something goes wrong:

  process:
    field_fecha:
      plugin: format_date
      from_format: 'Y'
      to_format: 'Y-m-d\TH:i:s'
      settings:
        validate_format: false
      source: year

I'm not sure if Y is allowed as from_format value. But I also don't know what standard value uses Drupal 8 date field and what to put as to_format value.


texts: Using migrate, how can you set the default format to Full HTML?

texts:
Using the migrate module to import content from a database. One of the fields contains full HTML but on import the text field defaults to plain text. The admin default is set to Full HTML, but even though the imports are being created by admin, it defaults to plain text.

How do you set the default to full HTML for imports? There's obviously a way around this in code but wondering if there's a patch or anyone has advice on the right approach.


texts: Can anyone provide a snippet code that is applicable for Drupal 6?


texts: How can I configure visibility rules for mini-panel panes based on url alias?

texts:
I'm using panels everywhere (I'm new to this) and thought it would be a good idea to create a mini-panel for my header and include that in my panels-based site layout. I want to switch the main menu in this header based on the url structure (mydomain.com/dogs would have a different menu than mydomain.com/cats).

I thought it made sense to create different menus for each scenario and configure their visibility settings based on that url structure. However, when I try to configure visibility settings for any content added to a pane within my header mini-panel based on "String: URL path", nothing happens and it's hidden for every page.

I should mention that the Path dropdown in the visibility settings only has the option of 'No context'. Should this have an 'aliased url' option? When I enter say, 'node/28' the visibility filter works correctly, but not for the aliased url.

I should also mention that we're running this site on IIS, but have done this many times with Drupal.

What am I missing here?


texts: Does Drupal distinguish types of error messages?

texts:
In D7, under Configuration > Development > Logging and errors you can set "Error messages to display" to "none".

However, I would think users should still be able to see form error messages, for example when they don't fill out a required field.

Are there different 'types' of 'error messages'?


texts: How to access the fields of a custom node variable in a custom Rules event?

texts:
I have created a custom Rules event, following the instructions in https://drupal.stackexchange.com/a/215857/16550 The event provides a custom node variable:

function MYMODULE_rules_event_info() {
  return array(
    'my_event' => array(
      'label' => t('My custom event'),
      'group' => t('My group'),
      'module' => 'MYMODULE',
      'variables' => array(
        'my_variable' => array('type' => 'node', 'label' => t('This is a node')),
      ),
    ),
  );
}

As expected, the variable my-variable shows up in the available tokens in a new Rule. I would now like to modify a field called Integer of the my-variable node, so I tried adding the conditions

Entity is of type: Quiz result answer
Entity has field: field_integer

However, I still cannot access my-variable:field_integer in any Rules actions. How can I do that?

Note: As the first Rules condition suggests, my variable my-variable is actually a Quiz result answer, provided by the Quiz module. I don't think it is related to the problem, but one never knows for certain...


texts: How do I filter users by status not blocked?

texts: I created a Drupal 7 view that displays users profile 2 fields. However if i disable the user their fields are still visible in the view. Is there a way i can filter users by their status of blocked or active?


texts: PDO exception error [database].semaphore doesnot exist

texts:
I created a website in drupal 7, tested it in my localhost and works good. Now, I want to host the site in our Main server. So, I uploaded the site directory to the server and created a corresponding database for that. Updated the settings.php file with the database name, user and password.

I do hope that the site install process is done. The site is deployed within the server, database created. When I give the address of the site, it shows some PDO exception error.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '[database].semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of /home/cpath/D-6.12/apache2/htdocs/[htdocs]/includes/lock.inc).

I tried re-installing the drupal site, it didn't work.

I even reviewed and tried all the solutions shown in drupal.org, but no way I couldn't resolve the issue.

I appreciate your valuable suggestions.


texts: Can I use menu path with argument wildcard in Views?

texts:
I have Views profile list displayed as page. View path is 'mymod/%mymod_param/foo'.

According to docs I can set wildcard value by a function (hook_menu)

Function to set url param:

function mymod_param_to_arg($arg) {
 //some logic returning param: 'all' or $nid related to current user object
}

Above function works.

Contextual filter settings:

Wildcard is altered in url properly. When I'm testing View in Views UI all works ok. But when I'm clicking main menu link leading to this View, I've always 403 or 404 (based on filter settings)


texts: How to send email to a specific organic groups role using rules?

texts:
I'm trying to set up a Rule to send an email to organic group members with a specific og role, in this case 'captain', when new group content 'Ticket' is created.

I've been able to set it up for all members of a group, even for group managers, but I can't figure out how to filter it just for a specific og role.

{ "rules_alert_captains" : {
"LABEL" : "Alert Captains",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "og", "rules" ],
"ON" : { "node_insert--ticket" : { "bundle" : "ticket" } },
"IF" : [ { "og_entity_is_group_content" : { "entity" : [ "node" ] } } ],
"DO" : [
  { "og_get_members" : {
      "USING" : { "group_content" : [ "node" ] },
      "PROVIDE" : { "group_members" : { "group_members" : "List of group members" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "group-members" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "mail" : {
            "to" : [ "group-members:0:mail" ],
            "subject" : "Hello",
            "message" : "This is an email",
            "language" : [ "" ]
          }
        }
      ]
    }
  }
]

}
}

Edit: My PHP attempt

{ "rules_alert_captains_php" : {
"LABEL" : "Alert Captains PHP",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "og", "php", "rules" ],
"ON" : { "node_insert--ticket" : { "bundle" : "ticket" } },
"IF" : [ { "og_entity_is_group_content" : { "entity" : [ "node" ] } } ],
"DO" : [
  { "og_get_members" : {
      "USING" : { "group_content" : [ "node" ] },
      "PROVIDE" : { "group_members" : { "group_members" : "List of group members" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "group-members" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "php_eval" : { "code" : "$og_roles = og_get_user_roles($node-\u003Egroup_audience[\u0027und\u0027][0][\u0027gid\u0027], $list_item-\u003Euid, true);\r\n\r\nif($og_roles) {\r\n  $og_role_names = og_get_user_roles_name($og_roles);\r\n}\r\n\r\nif(in_array(\u0027captain\u0027, $og_role_names)) {\r\n\/\/ or send an email\r\ndrupal_set_message(\u0022message going to be sent to user $list_item-\u003Ename\u0022);\r\n}" } }
      ]
    }
  }
]

}
}


texts: Drush fails "unable to copy" to drush-backups?

texts:
When I run $ drush pm-update I receive an "Unable to copy" error.

  Unable to copy /mnt/hd0/vhosts/yourwebsite.com/drupal-7.36 to /home/ec2-user/drush-backups/opencall/20150422140414/drupal.               [error]
  Unable to move /mnt/hd0/vhosts/yourwebsite.com/drupal-7.36 to /home/ec2-user/drush-backups/opencall/20150422140414/drupal.               [error]
  Failed to backup project directory /mnt/hd0/vhosts/yourwebsite.com/drupal-7.36 to

Any thoughts? I'm sure it will run if I use sudo but that has other undesirable consequences.


texts: Different rankings in a view based on geolocation

texts:
I'm currently building a site which has a ranking table.
I'd need the rankings to be different based on geolocation so what i'v done so far is building a different view for each country.
So the question is - how do i display them based on the session's location? (different home page and navigation for different countries)

Any explanation would be more than welcomed.

Edit: I'm using Zen theme.


texts:
When I translate field labels via admin/config/regional/translate/translate then my changes are happening in the frontend - but this does not work for fields which I created myself. Those fields are available for translation in the same spot but changes to them have no effect - it always uses the original text.

In my case it's about some additional fields in the registration form. I have de/user/register and fr/user/register and the pre-existing fields are in the correct language and if I do changes to them, then they are applied. But if I provide translations for the fields which I added, then they just don't show up.

I am using Drupal 7.14. On the picture, you see the custom field "wohnort". The first one has been there right after the creation of the custom field; the second one only after the Field Translation module and the i18n pack.


texts: How do I create a hidden field programatically?

texts:
I've got a module that is creating fields programatically, all working so far. The code is below. This may be useful as-is if you are trying to create checkboxe fields from an array of values:

    /**
     * Helper function to create fields for workflow approvers
     *
     */

    function _create_approval_fields($approverRolesClean){
      $fieldPrefix = 'wf_';

      // TODO: If an existing field is removed, delete it.

      foreach ($approverRolesClean as $approverRole) {
        $cleanRole = preg_replace('/[^a-z]/', "", strtolower($approverRole));
        $fieldName = $fieldPrefix.$cleanRole;
        if (!field_info_field($fieldName)) {
          $field = array(
            'field_name' => $fieldName,
            'type' => 'list_boolean',
            'widget' => array(
              'type' => 'options_onoff',
              'settings' => array(
                'display_label' => '1',
              ),
            ),
            'settings' => array(
              'allowed_values' => array(
                '0' => 'No',
                '1' => 'Yes',
                ),
              ),
            );
          field_create_field($field);
        }
        //Hardcoded:
        if (!field_info_instance('node', $fieldName, 'contenttype')) {
          $instance = array(
            'field_name' => $fieldName,
            'entity_type' => 'node',
            'label' => 'Approved by ' . $approverRole,
            //Hardcoded:
            'bundle' => 'contenttype',
            'widget' => array(
              'type' => 'options_onoff',
              'settings' => array(
                'display_label' => '1',
              ),
            ),
          );
          field_create_instance($instance);
        }
      }
    }

I set the value of the fields outside the Edit screen - so they never need to show there. I'm sure there is a settings parameter that I can add to hide it, but not sure where to find the doc. I don't think no_ui is what I need.

Otherwise I can use the form api to hide it at render time, but that doesn't seem as elegant.

Thanks,

Jack


texts: Want to build a widget which gives price history on Drupal 7

texts:
We have our site built on Drupal 7. We want to make a widget which gives price history chart.

I found a module named Commerce Price History.
Can this module be used with Drupal 7 or it can be used only with Drupal
commerce.

Is there any other Drupal Module which can achieve the same.


texts: Results of autocomplete field in form depending on another field - Drupal 7

texts:
I have an autocomplete field in a Drupal form made with Form API. It works great, suggesting the data from a db_query.

However, I would like to alter this db_query depending on the selection made in another field of the form (a select field).

But I don't know how to do it, as I would need to change the db_query parameters on-the-fly (Javascript) but they are hard-coded in PHP!!

Is what I want possible at all? (it can be done in pure HTML + Javascript + AJAX PHP but I cannot imagine how to do it in Drupal).


texts: Add Place holder Inside views exposed filter , If left empty

texts: How to add placeholder inside views exposed filter , only after submitting it , if left empty? but show results on basis of other exposed filters . This question is different in a way that i want to add place holder only after submitting a query and not pacing it in general.


texts:
Running latest versions of Drupal, modules and Commerce Kickstart
with Ubuntu, 4 GB RAM
Low Free Hard Drive Space, Swap file 2installs50 MB

I have read the posted how to installs but it still won't install.  I have only 1 GB of free space but I'm not sure that is the problem.   I suspect Kickstart unpacks itself and installs all at once, but I do not know.  Any suggestions?


texts:
I am tring to perform the following sql query to check if the name that was inserted to the form already created as taxonomy name. But I keep getting this error message:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'test' in 'where clause': SELECT COUNT(*) FROM {taxonomy_term_data} WHERE name = test; Array ( ) in get_google_map_api() (line 79 of /Applications/MAMP/htdocs/Drupal/sites/all/modules/toodate/toodate.module).

my function is:

function get_google_map_api($item){
    $city_name = $item;
    $chack_if_is_taxonomy = (db_query("SELECT COUNT(*) FROM {taxonomy_term_data} WHERE name = ".$city_name));
    var_dump($chack_if_is_taxonomy);
    drupal_exit();
}


texts: How to perform a page redirect after submitting node with conditions?

texts:
I have a select list which contains A and B. If users choose A, then (after submitting the node) the users are redirect to URL A; if users select, they are redirected to URL B. I'm using Rules and adding conditions to try this but no avail.

Maybe I'm wrong in choosing the conditions because I'm so confused right now and there's no documentation for this.

I've considered to use the Conditional Rules module, but since this project not covered by Drupal, I'm hesitating to use it.


texts: Send out welcome e-mail in users selected language

texts:
Whenever I create a new user, I want to send a welcome e-mail to the user.
This email is translated in both English and Chinese using the Internationalization module.

But when I check Chinese for a user, it still sends out the email in English.

The only option is to switch to the Chinese interface and then create the user, is there a way that when I select Chinese it will send out the email in that language? Regardless or not the interface is in that language?


texts: Editing the 'default front page' base URL

texts:
I rebuilt a new server from another server's image. And I want to use it for a new domain, but I'm finding that the new server continues to redirect to the original server's domain.

Going to the new server's drupal admin console, I see that the domain (ie, https://mysite.com/) is uneditable under Configuration > System > Site Information > Front Page > Default Front Page.

I tried setting the 'base_url' in /etc/drupal/7/sites/default/settings.php to my new domain and flushed the cache, but that didn't resolve the problem (and the old domain still persists in the console).


texts: Domain administrator role that can only see users of that domain

texts: Is it possible to define a "Domain Administrator" that would only be able to see the users (in the People interface) assigned to the same domain as itself? I've got a few Domain Access modules installed, but I still can't seem to figure this out.


texts: Programmatically manipulate content type select list

texts:
I have a content type called Car which have several field two of them are select lists which I want to make some operations on them. When the user select a value form the first select list a bulk of values should be populated in the other select list, my question is WHERE to do this programmatically and some tips for HOW doing this? I hope my question is clear

best


texts: Organic Groups cannot set Membership type when i add a user to a group

texts:
I am using OG 2.7, I have just created a new membership type. however when I go to add a user to a group content type, it is not letting me choose what membership type to use. It only shows the user auto-complete, a check-box to choose the role and the default membership type fields.
Why can it be that I cannot see the membership type selector??
Is there any place in configuration where it can be enable or disabled?
What could I be missing here?

Thank you for your help!


texts:
I am working on a drupal 7 installation. This has a content type called Team. In Structure > Views there is a view called Team content. In the folder structure there is also a corresponding view file named node--view--team.tpl.php which renders the Team content.

My task is to duplicate the content type to a new content type called Managers. So I created a new content type called Managers with all the same fields as in Team. I cloned the Team view as well. I then copied over the team tpl file into a new file named node--view--managers.tpl.php.

The problem I am facing is that the manager tpl file is not used when drupal renders the content. It falls back to node.tpl.php - however the design of this page is not how I want it.

What am I missing here? Is there any place in the code/ admin interface where I can specify that node--view--manager.tpl.php should be used instead of node.tpl.php?

Any pointers are greatly appreciated!


texts: Custom error for user registration page in D7 not working

texts:
I can't seem to figure out why this custom module refuses to execute for user registration validation. I've made sure I'm using the correct form id using firebug, verified the module is installed properly, but this module just refuses to show an error when the username is left blank during registration.

I thought the issue might have to do with the theme I'm currently using (Venture Theme), but I'm not really sure how to check the theme to verify the id's weren't changed. Anyone have an idea why this code won't run properly?

<?php
/**
* Implements hook_form_alter().
*/
function validation_form_user_register_form_alter(&$form, &$form_state) {
    $form['#validate'][] = 'validation_user_register_validate';
}

function validation_user_register_validate($form, &$form_state) {
  if (empty($form_state['values']['name'])){
        form_set_error('name', t('username is empty!'));
    }
}


texts: drupal is welcoming other user after login

texts:
I have website built on drupal 6.26.
Now i am facing a trouble that sometimes when the user logs in, the website is showing him Welcome message to another user!! for example if you login using user X, after reload of the page, it will show you a message of "Welcome Y" and shows the profile page of Y. fortunately, it shows profile Y but without Editing permission. and if you try to visit X's profile, it will be editable!!.
Any idea what could cause such ambiguity??


texts:
How to remove webform error message? I need to be able to remove the error message form.

For instance, if I have an email field and for some reason did not pass the validation is not to show a message saying.

  The entered e-mail address "djhshsj" does not appear valid.

So my question is how I can remove that Drupal message?

Update 1: I had to render the error message below the button (I could not just move with CSS ). So I ended up doing my custom validation + error message.  And even though I have my custom validation, webform still validate if that field is correct or not. However, all I want to do is to remove the message NOT the validation.


texts: Body field is not displayed in Comment Views

texts:
I have a comments listing view. When I make the the row style as comments everything is displaying fine. But when I make the row style as fields and add the comment:comment field to the list, the comment body is not showing up.

Things I have checked

There is no field access for this field.
The field is using the default template, so it is not being overridden.
Checked the body field display settings, it is configured to show and format plain text is enabled.
I am previewing the view as admin so there should be no access concerns as well.
The view is showing other fields normally.
"Exclude this display" box unchecked.
Changed the theme to Bartik and also disabled the javascript to be double sure.
Comment related modules I have are ajax-comments and onecomment module. I disabled both, rebuilt permissions and cleared the cache :)


texts:
I have a content type thats is called course which has a field that is a reference to a taxonomy called category.

My specification tells to build a search where users can search for the course title, category and other fields that the course type has. The search functions like intended and everything works great except the display view. Here is my setup:

Drupal 8.5
Search Api with DB / Solr Backend. (tried both)

So to come back: each course can have multiple categorys to be in which means that the view has to be grouped by the category. If I do that my view displays this:

Category 1 Name

Course 1
Course 2

Category 1 Name, Category 2 Name

Course 3

Category 2 Name

Course 4
Course 5

Category 3 Name, Category 2 Name

Course 6

Category 3 Name

Course 7
Course 8
Course 9

As you can see courses that belong to multiple categorys are not listed underneath the respected category instead they are seperated by a comma. My goal is this:

Category 1 Name

Course 1
Course 2
Course 3

Category 2 Name

Course 3
Course 4
Course 5
Course 6

Category 3 Name

Course 6
Course 7
Course 8
Course 9

such behaivor is easy to do if you dont use search api and want just to display a normal view. I have already read this issue but it seems my goal is not possible.

I'm asking now here if something has changed or if its possible to get this done with writing custom code? Maybe tell search api to return every result and display them with custom code grouped by the categorys? Can anyone point me to the right direction?


texts: Services: Getting error 406 Node type is required - but I have specified the node type

texts:
I'm trying to create a node using jQuery to POST JSON.

I get the following error returned by the server:
Failed to load resource: the server responded with a status of 406 (Not Acceptable: Node type is required)

However, the type is definitely specified in my JSON string:

var data = '{"title":"Sample post ",
  "type":"article",
  "field_link":
            [{
             "url":"http://www.google.com",
            "title":"My title"
            }],
  "body":
            {
             "und":[{"value":"comments about something"}]
             }
  }';


texts: Switch between two views by clicking on a menu tab without any page refresh

texts:
I have created two views on my custom content type as two different blocks. I want to place them in a new page say /node/47. In node/47 there are two tabs...on clicking one of them view 1 appears and on clicking another on of them view 2 appears while view1 goes away...by default any of the view can appear on the page when its first visited..i do not want any page refresh to take place

Thanks


texts: Possible to access source database in prepareRow() in Migrate module?

texts:
I'm doing a D2D migration that requires a mapping table to map tids from the source site to the destination site. In prepareRow(), I need to check the tid for a certain vocabulary and get the corresponding tid for the destination site. For a couple reasons, this mapping table is kept in the source site. However, the problem is that the default db connection that is being used in prepareRow() is the destination db, not the source db any more, so running my query throws an error. How can I switch the connection to use the source db so I can access this table and cache it? The short term method would be to copy this table to the destination site, but this will be an ongoing migration, and I don't want to have to update the table manually in the destination site every time the table is updated.

Thanks.


texts: Deny access to non-existing sub-paths that bubble up to an existing node

texts:
I have a drupal site with a page 'About us' (url: example.com/about-us). So when you type the url it correctly opens up the 'About Us' page. But if you append that url with any garbage value or a sensible word (eg:  example.com/about-us/adfasd OR /home) it still opens up the 'About us' page.

Is there a way to restrict this?
That means the user should get an error (something like 'Page not found') if he enters a url for a page which is not valid or if there is not content for that url on the website.

Any kind of help or guidance is greatly appreciated.


texts:
I have a fieldset with one field by default. I want to add new fields by ajax (button "new item"). I can do it for usual field, but I have a problem with fieldsets.
How to do that?

For usual fields I do it like below:

$form['add_item'] = array(
    '#type' => 'button',
    '#value' => t('Add item'),
    '#ajax' => array(
        'wrapper' => 'content',
        'callback' => 'add_more_ajax',
        'method' => 'append',
        'affect' => 'fade',
    ),
);

function add_more_ajax($form, &$form_state) {
    $form['image'] = array(
        '#title' => t('Image'),
        '#type' => 'managed_file',
        '#default_value' => '',
        '#upload_location' => 'public://images/',
    );
    return $form['image'];
}


texts: How to refresh an ad image in a page which is taken from google admanager module,the image are drawn as iframe while seeing its source.can anyone explain or provide code to refresh it and to change the next ad without page load.


texts: Trying to figure out which view to edit!

texts:
I have a main page of my site that has views and blocks. There is a photo view which I'm trying to figure out which one it is (drupal 6). I need to edit that view to change the sort order.

However (in admin mode) when I hover the cursor over the block of photos, the "Edit View" comes up and then when I move the cursor a bit upwards to edit it, the link disappears! So it's driving me mad which view to edit.

I have then gone to "site building"/ views / list and then I've changed the sort order of every view that has been named by that title but still the sort order on the main page doesn't change (i want to add sticky sort order).

So can anyone help by letting me know how to catch the edit view link that disappears when I hover the cursor around it? Thanks!


texts: Can I put batch api callbacks in an include file?

texts:
I have a .module file that is getting quite lengthy, and I added some batch functionality to it. I put the form and batch callbacks in a separate .inc file, and added the appropriate file directive to the menu array.

I was able to get the form submission to work, but the batch api threw the error Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_my_batch_callback' not found or invalid function name in _batch_process(). I got this error until I moved the batch callbacks into the .module file.

Is it possible to put the batch callbacks into a separate include file? Or have I just done something wrong?


texts: Sending emails on a specified interval, based on a date field

texts:
So I'm trying to create a schedule that will send an email to a user on a few dates - on their birthday (in the system), and on whatever registration dates they have for a program (NOT their user registration - this is a separate date field).

So there will be between 2 and 11 date fields per person.

I would like to send an email on a certain interval - say, on their birthday, or a year after one of their other registrations.

How would I go about this? Rules doesn't seem to have any specific "send based on date field value" condition. I'm seeing something about possibly running on drush cron and checking date fields individually, but wouldn't this get resource intensive with a high number of users with up to 11 fields?

How is this (I would think fairly normal) use case usually dealt with?


texts: How can I make the taxonomy terms appear in a drop down list?

texts:
How to make the taxonomy term in drop down list?

Vocabul

Drupal 6 taxonomy term in drop down list while creating new article.

Drupal 8 taxonomy term can't show drop down list while creating new article.


texts: Node teasers in node object filled with full node body if teaser is not defined

texts:
When Editor saves the Node, If teaser field is filled, normally teaser node object is filled with that content.
But if Teaser field is not filled, System is populating teaser of node object with body of the Node.

That is kind of weird because i need to detect if node has teaser or not, programatically.

Is there a workaround how i could detect programatically that Node was saved without teaser has been touched ?


texts:
I'm looking for a solution to handle the comments, login and register via AJAX. Why ? Actually I'm loading my content in Overlay-Boxes and get the content with JSON-Views, but it should be possible to comment the articles in these boxes.

The problem is that the box with the content is only loaded when you click a link. I just downloaded a module to realize the AJAX form, but this only worked in static content like mysite.org/nodes/15 - no problem. But when I load a node via AJAX in an overlay-Box it doesn't work, because I must restart the module to grab the new loaded form.

I hope you understood what my problem is. Is there any solution to realise my problem, or is there already a module that I can use for this?


texts:
I have searched long and hard for this, but I cannot figure out how to add a node to a taxonomy term.

I have taxonomy (Region) with term (North America) and I am trying to add the node (USA) to North America.

Could someone please teach me how this can be done? I just cannot find it anywhere on Drupal 7 Admin controls.


texts: How to execute rules action programatically

texts:
Is it possible to execute a rule action upon form submission? I've created a rule and disabled it, so it'll be only called if it meets the condition I've set. Below is a sample code I've been using:-

function hook_form_FORM_ID_alter(&$form, &$form_state) {
  if ($form_state['values']['field_name'][LANGUAGE_NONE][0]['value'] == 1)
    rules_invoke_component('rules_uncheck_update_checkbox', $form_state['commerce_order']);
  }
}

Not sure what are the other options as I've been stuck to make it work. Please help. Thank you.

EDIT:

Rules export

{ "rules_uncheck_update_checkbox" : {
"LABEL" : "Uncheck checkbox",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "rules", "entity" ],
"ON" : { "commerce_order_update" : [] },
"IF" : [
  { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "field_update_checkbox" } }
],
"DO" : [
  { "data_set" : { "data" : [ "commerce-order:field-update-checkbox" ], "value" : "0" } }
]
}
}


texts:
I have a route that requires a CSRF token:

mp.ajax.authorized:
  path: /mp/ajax/authorized
  defaults:
    _controller: 'Drupal\mp\Controller\AjaxController::authorizedCallback'
  requirements:
    _csrf_token: 'TRUE'

I need to generate a URL for this route. As the route has _csrf_token set to TRUE, the route needs to contain a CSRF token.

I've generated a URL from the route using Url:

Url::fromRoute('mp.ajax.authorized', [], ['absolute' => TRUE])->toString()

It generates a route with a token:

http://example.com/mp/ajax/authorized?token=91018d3f93299fe116c5596ea32d9addca063a92

I also tried the url_generator service to generate the URL:

$url_generator = \Drupal::service('url_generator');
$url = $url_generator->generateFromRoute('mp.ajax.authorized', [], ['absolute' => TRUE]);

And it generates the same URL.

However, the token on the URL is incorrect, as the actual CSRF token that is retrieved from CsrfTokenGenerator is:

1qG-Tw4AyQgNmVWtlkp_to7mielSz8ZfQZAkhWqAlsQ

I've done some reading, and it appears that the token given from Url is a placeholder, but I need the actual token, not the placeholder. Does anyone know how to get this?

Update: I've discovered I can retrieve the URL with a token in it by passing token as a parameter to the Url builder:

Url::fromRoute('mp.ajax.authorized', [], ['absolute' => TRUE, 'query' => ['token' => \Drupal::csrfToken()->get()]])->toString()

However, this token fails validation in Drupal\Core\Access\CsrfAccessCheck, so it appears this is not the correct solution.


texts: Can i attach a views grid of images in a carousel

texts: Hi i'm new to Drupal and this maybe kinda of advance, but how can i achieve a Drupal views of images grid format displayed in a carousel as shown in the image above


texts:
Is there any way to setup multilingual labels in views' fields.

Let´s say I have the ´title´ field and it shows the label ´My Title:´. Then as my site is bilingual (english-spanish) I need to have that label to ´Mi Titulo´ depending on user language.

How can I solve this?
Any module to expand views module?


texts: Link To Already Defined Path In Menu Using hook_menu()

texts:
I'm sure this is an obvious answer but I seem to be missing something important.

How can I add a link to a menu using hook_menu() to an already defined path?

I'm trying to add a direct link to a node/add page that already exists.

I need to use hook_menu() instead of the control panel.


texts:
I'm trying to get the enabled content type machine names for a given group.

I wrote the following code, but to get the machine name I should cut the strings to group_node:.

    /** @var \Drupal\group\Entity\GroupType $group */
    $group = GroupType::load($groupKey);
    $plugins = $group->getInstalledContentPlugins();
    foreach ($plugins->getConfiguration() as $key => $plugin) {
      // Cut key here.
    }


texts: DP7 views not honoring the theming information templates?

texts:
I'm using drupal 7 with views and panels modules with my own very simple theme that only has mytheme.info and a css file in the sites/all/themes/mytheme directory.

I created a new views-view--myview.tpl.php file in the theme folder and then clicked "Rescan template files" in the view theming information window. This template becomes bolded indicating that it is recognized by drupal.

My problem is: none of the content in the views-view--myview.tpl.php are reflected in the actual output (when opening a page with this view)!

I've found similar looking questions here but in many of them the problem was that the new .tpl.php file wasn't in the theme folder. In my case it is and it's still not working. Could anyone give an advice on how to solve this?


texts: Allow users to publish content to their profiles

texts:
I want my users to be able to upload content to their own profiles. then when people view their profile they see a list of links which lead to what the user has uploaded.

Is this possible?